Skip to content

Commit

Permalink
Attempt and fail to replace mark.serial with mark.order
Browse files Browse the repository at this point in the history
  • Loading branch information
jacg committed Feb 11, 2021
1 parent a83a56b commit 632f281
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
6 changes: 3 additions & 3 deletions invisible_cities/cities/irene_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_irene_electrons_40keV(config_tmpdir, ICDATADIR, s12params,


@mark.slow
@mark.serial
@mark.order('last')
def test_irene_run_2983(config_tmpdir, ICDIR, s12params):
"""Run Irene. Write an output file."""

Expand All @@ -130,7 +130,7 @@ def test_irene_run_2983(config_tmpdir, ICDIR, s12params):


@mark.slow # not slow itself, but depends on a slow test
@mark.serial
@mark.order('last')
def test_irene_runinfo_run_2983(config_tmpdir, ICDATADIR):
"""Read back the file written by previous test. Check runinfo."""

Expand Down Expand Up @@ -162,7 +162,7 @@ def test_irene_runinfo_run_2983(config_tmpdir, ICDATADIR):
assert run_number_in == run_number_out


@mark.serial
@mark.order('last')
@mark.slow
def test_irene_output_file_structure(config_tmpdir):
PATH_OUT = os.path.join(config_tmpdir, 'run_2983_pmaps.h5')
Expand Down
3 changes: 1 addition & 2 deletions invisible_cities/cities/penthesilea_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def test_penthesilea_signal_to_noise(ICDATADIR, output_tmpdir):
assert_dataframes_close(output_dst[columns], expected_dst[columns], check_types=False)


@mark.serial
def test_penthesilea_produces_mcinfo(KrMC_pmaps_filename, KrMC_hdst, config_tmpdir):
PATH_IN = KrMC_pmaps_filename
PATH_OUT = os.path.join(config_tmpdir, "Kr_HDST_with_MC.h5")
Expand All @@ -193,7 +192,7 @@ def test_penthesilea_produces_mcinfo(KrMC_pmaps_filename, KrMC_hdst, config_tmpd
assert "MC/particles" in h5out.root


@mark.serial
@mark.order(after='test_penthesilea_produces_mcinfo')
def test_penthesilea_true_hits_are_correct(KrMC_true_hits, config_tmpdir):
penthesilea_output_path = os.path.join(config_tmpdir,'Kr_HDST_with_MC.h5')
penthesilea_evts = load_mchits_df(penthesilea_output_path)
Expand Down
1 change: 0 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[pytest]
markers =
slow: marks tests as slow
serial: marks tests as serial
filterwarnings =
ignore:can't resolve package from __spec__ or __package__, falling back on __name__ and __path__:ImportWarning
ignore::FutureWarning:scipy.signal.signaltools:3463
Expand Down
18 changes: 14 additions & 4 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ let
buildInputs = [ pypkgs.pytest ];
};

# pytest-order was unavailable in nixpkgs at time of writing (not to be
# confused with pytest-orderING, of which this is a fork)
mk-pytest-order = pypkgs:
pypkgs.buildPythonPackage rec {
pname = "pytest-order";
version = "0.9.3";
src = pypkgs.fetchPypi {
inherit pname version;
sha256 = "1qd9zfpcbzm43knkg3ap22wssqabc2wn5ynlgg661xg6r6g6iy4k";
};
buildInputs = [ pypkgs.pytest ];
};

command = pkgs.writeShellScriptBin;

Expand All @@ -51,6 +63,7 @@ let
ps.hypothesis
ps.pytest_xdist
(mk-pytest-instafail ps)
(mk-pytest-order ps)
]);

in
Expand All @@ -64,10 +77,7 @@ pkgs.mkShell {
(command "ic-test" "pytest --instafail --no-success-flaky-report")
(command "ic-test-par" ''
N_PROC=$1
STATUS=0
pytest --instafail -n ''${N_PROC:-auto} -m "not serial" --no-success-flaky-report || STATUS=$?
pytest --instafail -m serial --no-success-flaky-report || STATUS=$?
[[ $STATUS = 0 ]]
pytest --instafail -n ''${N_PROC:-auto} --no-success-flaky-report
'')
(command "ic-clean" ''
echo "Cleaning IC generated files:"
Expand Down

0 comments on commit 632f281

Please sign in to comment.