tskit-dev / tszip

Gzip-like compression for tskit tree sequences
https://tszip.readthedocs.io/
MIT License
4 stars 7 forks source link

Tests pass in pytest by default but not with -n0 #47

Closed jeromekelleher closed 3 years ago

jeromekelleher commented 3 years ago

Seeing some very strange behaviour:

$ pytest tests/test_compression.py
==================================== test session starts =====================================
platform linux -- Python 3.8.10, pytest-6.1.2, py-1.9.0, pluggy-0.13.1
rootdir: /home/jk/work/github/tszip, configfile: setup.cfg
plugins: forked-1.3.0, timeout-1.4.2, regressions-2.2.0, mock-3.5.1, cov-2.10.1, xdist-2.1.0, datadir-1.3.1, hypothesis-6.12.0
gw0 [37] / gw1 [37] / gw2 [37] / gw3 [37]
...........ss........................                                                  [100%]
=============================== 35 passed, 2 skipped in 1.68s ================================

$ pytest -n0 tests/test_compression.py
================================================================================== short test summary info ===================================================================================
FAILED tests/test_compression.py::TestGenotypeRoundTrip::test_small_msprime_individuals_metadata - AssertionError: <tskit.tables.IndividualTable object at 0x7f61ec07d2b0> != <tskit.tables...
FAILED tests/test_compression.py::TestExactRoundTrip::test_all_fields - AssertionError: Metadata schemas differ: self=OrderedDict([('codec', 'json')]) other=None
FAILED tests/test_compression.py::TestExactRoundTrip::test_small_msprime_individuals_metadata - AssertionError: IndividualTable row 1 differs:
FAILED tests/test_compression.py::TestExactRoundTrip::test_small_msprime_migration - AssertionError: MutationTable row 0 differs:
FAILED tests/test_compression.py::TestExactRoundTrip::test_small_msprime_no_recomb - AssertionError: MutationTable row 0 differs:
FAILED tests/test_compression.py::TestExactRoundTrip::test_small_msprime_recomb - AssertionError: MutationTable row 0 differs:
FAILED tests/test_compression.py::TestExactRoundTrip::test_small_msprime_top_level_metadata - AssertionError: Metadata schemas differ: self=OrderedDict([('codec', 'json'),
========================================================================== 7 failed, 28 passed, 2 skipped in 1.61s ===========================================================================

It seems like we're loading the installed version of tszip rather than the local one when we're running tests?

Is this possibly the cause of this weird failure we're getting in #45?

Possibly an issue with pytest 6.1.2 and maybe we could downgrade?

jeromekelleher commented 3 years ago

I don't know what's going on here - for some reason we're importing tszip version 0.1.0 (the installed version) rather than the local version. Maybe pytest is doing something to its CWD or something?

I think that's the issue we're having with #45 on circle CI - it's failing because there isn't an installed version of tszip.

Any ideas @benjeffery?

benjeffery commented 3 years ago

This is something odd in pytest that I haven't got to the bottom of. python3 -m pytest -n0 tests works.

jeromekelleher commented 3 years ago

Ah right, thanks. No need to keep this open then, we just recommend people use python3 -m pytest rather than pytest.