Skip to content

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Feb 19, 2024
1 parent bbbb545 commit 7a9c347
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/unittest-flux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ jobs:
mamba install -y flux-core=0.58.0 coverage
pip install versioneer[toml]==0.29
pip install . --no-deps --no-build-isolation
cd tests
coverage run --include="../pympipool/*" --omit="pympipool/_version.py,test_*" -m unittest discover .
coverage run --omit="pympipool/_version.py,tests/*" -m unittest discover tests
env:
OMPI_MCA_plm: 'isolated'
OMPI_MCA_rmaps_base_oversubscribe: 'yes'
OMPI_MCA_btl_vader_single_copy_mechanism: 'none'
- name: Coveralls
if: matrix.label == 'linux-64-py-3-12-openmpi'
uses: coverallsapp/github-action@v2
- name: Test Flux
shell: bash -l {0}
timeout-minutes: 5
run: >
flux start
python -m unittest tests/test_flux.py;
coverage run --omit="pympipool/_version.py,tests/*" -m unittest tests/test_flux.py;
coverage combine
env:
OMPI_MCA_plm: 'isolated'
OMPI_MCA_rmaps_base_oversubscribe: 'yes'
OMPI_MCA_btl_vader_single_copy_mechanism: 'none'
- name: Coveralls
if: matrix.label == 'linux-64-py-3-12-openmpi'
uses: coverallsapp/github-action@v2
5 changes: 4 additions & 1 deletion pympipool/flux/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
from pympipool.flux.executor import PyFluxExecutor
try:
from pympipool.flux.executor import PyFluxExecutor
except ImportError:
pass
7 changes: 7 additions & 0 deletions tests/test_with_dynamic_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import unittest

from pympipool import Executor
from pympipool.shared.executorbase import cloudpickle_register


class Foo:
Expand Down Expand Up @@ -76,6 +77,7 @@ def slowly_returns_dynamic(dynamic_arg):

dynamic_dynamic = slowly_returns_dynamic()
executor = Executor(hostname_localhost=True)
cloudpickle_register(ind=1)
dynamic_object = does_nothing()
fs = executor.submit(dynamic_dynamic.run, dynamic_object)
self.assertEqual(
Expand Down Expand Up @@ -108,6 +110,7 @@ def slowly_returns_42():
msg="Just a sanity check that the test is set up right"
)
executor = Executor(hostname_localhost=True)
cloudpickle_register(ind=1)
fs = executor.submit(dynamic_42.run)
fs.add_done_callback(dynamic_42.process_result)
self.assertFalse(
Expand Down Expand Up @@ -140,6 +143,7 @@ def returns_42():
msg="Sanity check that the test starts in the expected condition"
)
executor = Executor(hostname_localhost=True)
cloudpickle_register(ind=1)
fs = executor.submit(dynamic_42.run)
fs.add_done_callback(dynamic_42.process_result)
self.assertTrue(
Expand All @@ -163,6 +167,7 @@ def raise_error():

re = raise_error()
executor = Executor(hostname_localhost=True)
cloudpickle_register(ind=1)
fs = executor.submit(re.run)
with self.assertRaises(
RuntimeError,
Expand Down Expand Up @@ -192,6 +197,7 @@ def slowly_returns_dynamic():

dynamic_dynamic = slowly_returns_dynamic()
executor = Executor(hostname_localhost=True)
cloudpickle_register(ind=1)
fs = executor.submit(dynamic_dynamic.run)
self.assertIsInstance(
fs.result(),
Expand Down Expand Up @@ -220,6 +226,7 @@ def slow():

f = slow()
executor = Executor(hostname_localhost=True)
cloudpickle_register(ind=1)
fs = executor.submit(f.run)
self.assertEqual(
fs.result(timeout=30),
Expand Down

0 comments on commit 7a9c347

Please sign in to comment.