forked from scverse/scanpy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
753f072
commit d979267
Showing
8 changed files
with
204 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,39 @@ | ||
# Scanpy | ||
.pytest_cache/ | ||
.scanpy | ||
.coverage | ||
figures/ | ||
cache/ | ||
coverage.xml | ||
test.h5ad | ||
test_compr.h5ad | ||
test_no_compr.h5ad | ||
docs/_build | ||
docs/api/scanpy.api.*.rst | ||
docs/api/scanpy.*.rst | ||
!docs/api/scanpy.api.rst | ||
!docs/api/scanpy.api.AnnData.rst | ||
!docs/api/scanpy.plotting.rst | ||
archive/ | ||
data/ | ||
figs/ | ||
*/figs*/ | ||
write/ | ||
/examples/ | ||
scanpy.egg-info/ | ||
scanpy_user/ | ||
scanpy_save/ | ||
scanpy_later/ | ||
scripts_test/ | ||
thirdp/ | ||
test.py | ||
README.html | ||
scripts/ | ||
test_notebooks.txt | ||
upload_to_pypi.sh | ||
# Scanpy outfiles | ||
/cache/ | ||
/data/ | ||
/write/ | ||
|
||
# private files | ||
scanpy/examples/builtin_private.py | ||
scanpy/tools/paths.py | ||
scanpy/tools/tgdyn.py | ||
scanpy/tools/tgdyn_simple.py | ||
scripts/paths.py | ||
scripts/test_private.sh | ||
scripts/tgdyn.py | ||
scripts/tgdyn_simple.py | ||
.spyproject/ | ||
scanpy/.spyproject/ | ||
# Docs | ||
/docs/api/scanpy.*.rst | ||
!/docs/api/scanpy.api.rst | ||
!/docs/api/scanpy.api.AnnData.rst | ||
!/docs/api/scanpy.plotting.rstk | ||
|
||
# tests | ||
/.cache/ | ||
/.pytest_cache/ | ||
/scanpy/tests/test*.h5ad | ||
/scanpy/tests/figures/ | ||
/scanpy/tests/notebooks/figures/ | ||
|
||
# Environment management | ||
Pipfile | ||
Pipfile.lock | ||
/Pipfile | ||
/Pipfile.lock | ||
|
||
# always-ignore extensions | ||
*~ | ||
|
||
# Python / Byte-compiled / optimized / DLL | ||
# Python build files | ||
__pycache__/ | ||
*.py[cod] | ||
*.so | ||
.cache | ||
/dist/ | ||
/build/ | ||
/scanpy.egg-info/ | ||
|
||
# OS or Editor files and folders | ||
# OS stuff | ||
.DS_Store | ||
Thumbs.db | ||
.ipynb_checkpoints/ | ||
.directory | ||
/.idea/ | ||
|
||
# always-ignore directories | ||
/dist/ | ||
/build/ | ||
# IDEs and editors | ||
/.idea/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
import matplotlib as mpl | ||
mpl.use('agg') | ||
from matplotlib import pyplot | ||
from matplotlib.testing.compare import compare_images | ||
|
||
import scanpy | ||
|
||
scanpy.settings.verbosity = "hint" | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption( | ||
"--internet-tests", | ||
action="store_true", | ||
default=False, | ||
help="Run tests that retrieve stuff from the internet. This increases test time.", | ||
) | ||
|
||
|
||
def pytest_collection_modifyitems(config, items): | ||
run_internet = config.getoption("--internet-tests") | ||
skip_internet = pytest.mark.skip(reason="need --internet-tests option to run") | ||
for item in items: | ||
# All tests marked with `pytest.mark.internet` get skipped unless | ||
# `--run-internet` passed | ||
if not run_internet and ("internet" in item.keywords): | ||
item.add_marker(skip_internet) | ||
|
||
|
||
def make_comparer(path_expected: Path, path_actual: Path, *, tol: int): | ||
def save_and_compare(basename, tolerance=None): | ||
path_actual.mkdir(parents=True, exist_ok=True) | ||
out_path = path_actual / f'{basename}.png' | ||
pyplot.savefig(out_path, dpi=40) | ||
pyplot.close() | ||
if tolerance is None: | ||
tolerance = tol | ||
res = compare_images(str(path_expected / f'{basename}.png'), str(out_path), tolerance) | ||
assert res is None, res | ||
return save_and_compare | ||
|
||
|
||
@pytest.fixture | ||
def image_comparer(): | ||
return make_comparer | ||
|
||
|
||
@pytest.fixture | ||
def plt(): | ||
return pyplot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.