Skip to content

Commit

Permalink
Fix cwd of pytest
Browse files Browse the repository at this point in the history
Contributes: #84
  • Loading branch information
stephanzwicknagl committed Jun 15, 2024
1 parent 2859320 commit dca244b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions backend/test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ def parse(test_args):

def test_argparse_file():
test_args = [
'viasp/backend/test/resources/sample_encoding.lp',
'test/resources/sample_encoding.lp',
]
options = parse(test_args)[0]
assert len(options['files']) == 1
assert len(options['files'][0]) == 3
assert options['files'][0][0] == 'viasp/backend/test/resources/sample_encoding.lp'
assert options['files'][0][0] == 'test/resources/sample_encoding.lp'

def test_argparse_n_models():
test_args = [
'viasp/backend/test/resources/sample_encoding.lp',
'test/resources/sample_encoding.lp',
'0'
]
options = parse(test_args)[0]
assert options['max_models'] == 0

test_args = [
'viasp/backend/test/resources/sample_encoding.lp',
'test/resources/sample_encoding.lp',
'--models', '10'
]
options = parse(test_args)[0]
assert options['max_models'] == 10

test_args = [
'viasp/backend/test/resources/sample_encoding.lp',
'test/resources/sample_encoding.lp',
'-n5'
]
options = parse(test_args)[0]
Expand Down Expand Up @@ -71,7 +71,7 @@ def test_clingo_help():

def test_basic_argumens():
test_args = [
'viasp/backend/test/resources/sample_encoding.lp', '--host','localhost',
'test/resources/sample_encoding.lp', '--host','localhost',
'--port','8050',
'--frontend-port','3000',
]
Expand All @@ -82,14 +82,14 @@ def test_basic_argumens():

def test_opt_mode():
test_args = [
'viasp/backend/test/resources/sample_encoding.lp',
'test/resources/sample_encoding.lp',
'--opt-mode=optN',
]
options = parse(test_args)[0]
assert options['opt_mode'] == ('optN', [])

test_args = [
'viasp/backend/test/resources/sample_encoding.lp',
'test/resources/sample_encoding.lp',
'--opt-mode=opt,1,2',
]
options = parse(test_args)[0]
Expand All @@ -98,28 +98,28 @@ def test_opt_mode():

def test_select_model():
test_args = [
'viasp/backend/test/resources/sample_encoding.lp',
'test/resources/sample_encoding.lp',
'--select-model=1',
]
options = parse(test_args)[0]
assert options['select_model'] == [1]

def test_clingraph():
test_args = [
'viasp/backend/test/resources/sample_encoding.lp', '--viz-encoding',
'viasp/backend/test/resources/sample_encoding.lp', '--engine','neato',
'test/resources/sample_encoding.lp', '--viz-encoding',
'test/resources/sample_encoding.lp', '--engine','neato',
'--graphviz-type','digraph',
]
options = parse(test_args)[0]
assert len(options[
'clingraph_files']) == 1
assert options['clingraph_files'][0][0] == 'viasp/backend/test/resources/sample_encoding.lp'
assert options['clingraph_files'][0][0] == 'test/resources/sample_encoding.lp'
assert options['engine'] == 'neato'
assert options['graphviz_type'] == 'digraph'

def test_relaxer():
test_args = [
'viasp/backend/test/resources/sample_encoding.lp', '--no-relaxer',
'test/resources/sample_encoding.lp', '--no-relaxer',
'--no-collect-variables',
'--head-name', 'testhead'
]
Expand Down

0 comments on commit dca244b

Please sign in to comment.