From a0d6c37b4d5b024e18bf2a98694a38a22a9875c0 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sat, 30 Dec 2023 12:52:12 +0100 Subject: [PATCH 1/4] Fix testing for pytask v0.4.5. --- .gitignore | 1 + pyproject.toml | 4 ++-- tests/conftest.py | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fd09476..4a85b00 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ __pycache__ build dist src/pytask_parallel/_version.py +tests/test_jupyter/file.txt diff --git a/pyproject.toml b/pyproject.toml index d9a0995..5910540 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,8 +52,8 @@ Tracker = "https://github.com/pytask-dev/pytask-parallel/issues" [tool.setuptools] include-package-data = true zip-safe = false -platforms = [ "any",] -license-files = [ "LICENSE",] +platforms = ["any"] +license-files = ["LICENSE"] [tool.check-manifest] ignore = ["src/pytask_parallel/_version.py"] diff --git a/tests/conftest.py b/tests/conftest.py index 8cba383..3881664 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,6 +6,7 @@ import pytest from click.testing import CliRunner +from pytask import storage class SysPathsSnapshot: @@ -62,6 +63,7 @@ def _restore_sys_path_and_module_after_test_execution(): class CustomCliRunner(CliRunner): def invoke(self, *args, **kwargs): """Restore sys.path and sys.modules after an invocation.""" + storage.create() with restore_sys_path_and_module_after_test_execution(): return super().invoke(*args, **kwargs) From 37ed8ff163a1412a05323a8d265c4daa3ec0d2ae Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sat, 30 Dec 2023 15:41:48 +0100 Subject: [PATCH 2/4] Disable errors with nbmake on macos. --- tests/conftest.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 3881664..ef47c25 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,11 +1,13 @@ from __future__ import annotations +import os import sys from contextlib import contextmanager from typing import Callable import pytest from click.testing import CliRunner +from nbmake.pytest_items import NotebookItem from pytask import storage @@ -71,3 +73,11 @@ def invoke(self, *args, **kwargs): @pytest.fixture() def runner(): return CustomCliRunner() + + +def pytest_collection_modifyitems(session, config, items) -> None: # noqa: ARG001 + """Add markers to Jupyter notebook tests.""" + if sys.platform == "darwin" and "CI" in os.environ: # pragma: no cover + for item in items: + if isinstance(item, NotebookItem): + item.add_marker(pytest.mark.xfail(reason="Fails regularly on MacOS")) From c53b7d434f75ee9e0aba06c25374548ea7ca1896 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Fri, 12 Jan 2024 16:09:53 +0100 Subject: [PATCH 3/4] Fix new pytask version. --- .pre-commit-config.yaml | 2 +- environment.yml | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5857bd5..347348a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -65,7 +65,7 @@ repos: attrs, cloudpickle, loky, - pytask>=0.4.0, + pytask>=0.4.5, rich, types-click, types-setuptools, diff --git a/environment.yml b/environment.yml index 7b2ab71..27498f2 100644 --- a/environment.yml +++ b/environment.yml @@ -12,7 +12,7 @@ dependencies: - toml # Package dependencies - - pytask>=0.4.0 + - pytask>=0.4.5 - cloudpickle - loky - optree diff --git a/pyproject.toml b/pyproject.toml index 5910540..df23f52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ dependencies = [ "cloudpickle", "loky", "pluggy>=1.0.0", - "pytask>=0.4.0", + "pytask>=0.4.5", "rich" ] dynamic = ["version"] From 6e8d1218b877ff536f66bbb6583525a9d6893f10 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Fri, 12 Jan 2024 16:11:48 +0100 Subject: [PATCH 4/4] to changes. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 1210989..4a64b3e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask-parallel) and - {pull}`72` moves the project to `pyproject.toml`. - {pull}`75` updates the release strategy. - {pull}`79` add tests for Jupyter and fix parallelization with `PythonNode`s. +- {pull}`82` fixes testing with pytask v0.4.5. ## 0.4.0 - 2023-10-07