Skip to content

Commit

Permalink
Use local copy of demo model for testing.
Browse files Browse the repository at this point in the history
In an effort to keep all test fixtures in one place, a copy of the
tutorial model `capacitor.mph` from the `demos` folder was placed in
the `tests` folder, under the name `demo.mph`.

That file is used by very few tests: Only for loading files from disk
when testing the client, and when comparing tags created by MPh with
those generated by Comsol. All other tests create the (same) model
from scratch, via the `capacitor()` fixture in `models.py`.
  • Loading branch information
john-hen committed Feb 21, 2022
1 parent 1b6e489 commit 81a81a7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Binary file added tests/demo.mph
Binary file not shown.
6 changes: 3 additions & 3 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
########################################
client = None
model = None
demo = Path(__file__).resolve().parent.parent/'demos'/'capacitor.mph'
demo = Path(__file__).resolve().parent/'demo.mph'


########################################
Expand Down Expand Up @@ -63,7 +63,7 @@ def test_repr():

def test_contains():
assert model in client
assert 'capacitor' in client
assert 'demo' in client
assert 'empty' in client
assert 'non-existing' not in client

Expand All @@ -74,7 +74,7 @@ def test_iter():


def test_truediv():
assert client/'capacitor' == model
assert client/'demo' == model
with logging_disabled():
with raises(ValueError):
client/'non-existing'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_tag():
if not client.port:
# Skip test in client-server mode where it's fairly slow.
here = Path(__file__).resolve().parent
demo = client.load(here.parent/'demos'/'capacitor.mph')
demo = client.load(here/'demo.mph')
demo.solve()
root = Node(model, '')
compare_tags(root, demo)
Expand Down

0 comments on commit 81a81a7

Please sign in to comment.