diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 473d548e..3d81b13d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: - { python-version: 3.8, os: ubuntu-latest } - { python-version: 3.7, os: ubuntu-latest } - { python-version: 3.6, os: ubuntu-latest } - # - { python-version: 3.8, os: windows-latest } + - { python-version: 3.8, os: windows-latest } - { python-version: 3.8, os: macos-latest } steps: @@ -21,7 +21,7 @@ jobs: - uses: actions/setup-python@v2.1.1 with: python-version: ${{ matrix.python-version }} - # architecture: x64 + architecture: x64 - run: pip install nox==2020.5.24 - run: pip install poetry==1.0.9 - run: nox diff --git a/noxfile.py b/noxfile.py index a4cfa068..27d3450e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,5 +1,6 @@ """Nox Sessions.""" import tempfile +from pathlib import Path import nox @@ -9,23 +10,24 @@ def install_with_constraints(session, *args, **kwargs): """Install packages constrained by Poetry's lock file.""" - with tempfile.NamedTemporaryFile() as requirements: + with tempfile.TemporaryDirectory() as directory: + requirements = Path(directory) / "requirements.txt" session.run( "poetry", "export", "--dev", "--format=requirements.txt", - f"--output={requirements.name}", + f"--output={requirements}", external=True, ) - session.install(f"--constraint={requirements.name}", *args, **kwargs) + session.install(f"--constraint={requirements}", *args, **kwargs) @nox.session() def tests(session): """Run the test suite.""" args = session.posargs or ["--cov", "-m", "not e2e"] - session.run("poetry", "install", "--no-dev", external=True) + session.run("poetry", "install", external=True) install_with_constraints(session, "coverage[toml]", "pytest", "pytest-cov") session.run("pytest", *args) @@ -64,18 +66,18 @@ def black(session): @nox.session() def safety(session): """Scan dependencies for insecure packages.""" - with tempfile.NamedTemporaryFile() as requirements: + with tempfile.TemporaryDirectory() as directory: + requirements = Path(directory) / "requirements.txt" session.run( "poetry", "export", "--dev", "--format=requirements.txt", - "--without-hashes", - f"--output={requirements.name}", + f"--output={requirements}", external=True, ) install_with_constraints(session, "safety") - session.run("safety", "check", f"--file={requirements.name}", "--full-report") + session.run("safety", "check", f"--file={requirements}", "--full-report") @nox.session() diff --git a/tests/test_core.py b/tests/test_core.py index 63e9d18f..76730026 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1,5 +1,6 @@ import pytest +import matplotlib import matplotlib.pyplot as plt import numpy as np from matplotlib.axes import Axes @@ -7,6 +8,9 @@ import seaborn_image as isns +matplotlib.use("AGG") # use non-interactive backend for tests + + data = np.random.random(2500).reshape((50, 50)) diff --git a/tests/test_filters.py b/tests/test_filters.py index b975237c..00a4d6e9 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -1,5 +1,6 @@ import pytest +import matplotlib import matplotlib.pyplot as plt import numpy as np import scipy.ndimage as ndi @@ -8,6 +9,9 @@ import seaborn_image as isns +matplotlib.use("AGG") # use non-interactive backend for tests + + data = np.random.random(2500).reshape((50, 50)) filter_list = ["sobel", "gaussian", "median", "max", "diff_of_gaussians"] @@ -17,9 +21,7 @@ def test_filter_not_implemented(): isns.filterplot(data, filter="not-implemented-filter") -@pytest.mark.parametrize( - "filter", [["gaussian"], ndi.gaussian_filter, None] -) +@pytest.mark.parametrize("filter", [["gaussian"], ndi.gaussian_filter, None]) def test_filter_types(filter): with pytest.raises(TypeError): isns.filterplot(data, filter=filter) diff --git a/tests/test_general.py b/tests/test_general.py index ea1f4bca..f48d151f 100644 --- a/tests/test_general.py +++ b/tests/test_general.py @@ -1,5 +1,6 @@ import pytest +import matplotlib import matplotlib.pyplot as plt import numpy as np from matplotlib.axes import Axes @@ -7,6 +8,9 @@ import seaborn_image as isns +matplotlib.use("AGG") # use non-interactive backend for tests + + data = np.random.random(2500).reshape((50, 50)) @@ -120,7 +124,15 @@ def test_imghist_return(): @pytest.mark.parametrize("title_fontdict", [{"fontsize": 20}, None]) @pytest.mark.parametrize("describe", [True, False]) def test_imghist_w_all_valid_inputs( - cmap, bins, cbar, cbar_label, cbar_fontdict, showticks, title, title_fontdict, describe + cmap, + bins, + cbar, + cbar_label, + cbar_fontdict, + showticks, + title, + title_fontdict, + describe, ): f, axes, cax = isns.imghist( data,