Skip to content

Commit

Permalink
Addition of isInstance test of BackendSerial (#4773)
Browse files Browse the repository at this point in the history
* Update test_base.py

Addition of test for serial backend instance

* Update test_base.py

pep fix

* Update test_base.py

Adjusted test_instance_serial_backend to test through pytest raise ValueError
  • Loading branch information
talagayev authored Nov 20, 2024
1 parent b254921 commit 4e42f7a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions testsuite/MDAnalysisTests/analysis/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,19 @@ def test_parallelizable_transformations():
with pytest.raises(ValueError):
FrameAnalysis(u.trajectory).run(backend='multiprocessing')


def test_instance_serial_backend(u):
# test that isinstance is checked and the correct ValueError raise appears
msg = 'Can not display progressbar with non-serial backend'
with pytest.raises(ValueError, match=msg):
FrameAnalysis(u.trajectory).run(
backend=backends.BackendMultiprocessing(n_workers=2),
verbose=True,
progressbar_kwargs={"leave": True},
unsupported_backend=True
)


def test_frame_bool_fail(client_FrameAnalysis):
u = mda.Universe(TPR, XTC) # dt = 100
an = FrameAnalysis(u.trajectory)
Expand Down

0 comments on commit 4e42f7a

Please sign in to comment.