From fe7bd84ddb5c2b7b7808d9ca973e8c4a1800e392 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Thu, 10 Mar 2022 13:11:00 +0100 Subject: [PATCH 1/3] Remove unnecessary hook. --- CHANGES.rst | 6 ++++++ src/pytask_stata/collect.py | 19 ------------------- tests/test_collect.py | 20 -------------------- 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index f8a3230..b8bff6b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,12 @@ all releases are available on `PyPI `_ an `Anaconda.org `_. +0.2.0 - 2022-xx-xx +------------------ + +- :gh`:`20` removes an unnecessary hook implementation. + + 0.1.2 - 2022-02-08 ------------------ diff --git a/src/pytask_stata/collect.py b/src/pytask_stata/collect.py index 337f1a1..eaa96be 100644 --- a/src/pytask_stata/collect.py +++ b/src/pytask_stata/collect.py @@ -9,9 +9,7 @@ from _pytask.config import hookimpl from _pytask.mark_utils import get_specific_markers_from_task -from _pytask.mark_utils import has_marker from _pytask.nodes import FilePathNode -from _pytask.nodes import PythonFunctionTask from _pytask.parametrize import _copy_func from pytask_stata.shared import convert_task_id_to_name_of_log_file from pytask_stata.shared import get_node_from_dictionary @@ -37,23 +35,6 @@ def run_stata_script(stata, cwd): subprocess.run(stata, cwd=cwd, check=True) -@hookimpl -def pytask_collect_task(session, path, name, obj): - """Collect a task which is a function. - - There is some discussion on how to detect functions in this `thread - `_. :class:`types.FunctionType` does not - detect built-ins which is not possible anyway. - - """ - if name.startswith("task_") and callable(obj) and has_marker(obj, "stata"): - task = PythonFunctionTask.from_path_name_function_session( - path, name, obj, session - ) - - return task - - @hookimpl def pytask_collect_task_teardown(session, task): """Perform some checks and prepare the task function.""" diff --git a/tests/test_collect.py b/tests/test_collect.py index e0920b3..e285031 100644 --- a/tests/test_collect.py +++ b/tests/test_collect.py @@ -8,7 +8,6 @@ from _pytask.nodes import FilePathNode from pytask_stata.collect import _merge_all_markers from pytask_stata.collect import _prepare_cmd_options -from pytask_stata.collect import pytask_collect_task from pytask_stata.collect import pytask_collect_task_teardown from pytask_stata.collect import stata from pytask_stata.shared import get_node_from_dictionary @@ -97,25 +96,6 @@ def test_prepare_cmd_options(args, stata_source_key, platform): assert result == expected -@pytest.mark.unit -@pytest.mark.parametrize( - "name, expected", - [("task_dummy", True), ("invalid_name", None)], -) -def test_pytask_collect_task(name, expected): - session = DummyClass() - session.config = {"stata": "stata"} - path = Path("some_path") - task_dummy.pytaskmark = [Mark("stata", (), {})] - - task = pytask_collect_task(session, path, name, task_dummy) - - if expected: - assert task - else: - assert not task - - @pytest.mark.unit @pytest.mark.parametrize( "depends_on, produces, expectation", From 796f433b9860539219385022e259e8765e75e265 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Thu, 10 Mar 2022 13:50:04 +0100 Subject: [PATCH 2/3] Rename pipeline. --- .github/workflows/continuous-integration-workflow.yml | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index d27f8a1..882b9bb 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -1,4 +1,4 @@ -name: Continuous Integration Workflow +name: main # Automatically cancel a previous run. concurrency: diff --git a/README.rst b/README.rst index b890458..2d18586 100644 --- a/README.rst +++ b/README.rst @@ -16,7 +16,7 @@ :alt: PyPI - License :target: https://pypi.org/project/pytask-stata -.. image:: https://img.shields.io/github/workflow/status/pytask-dev/pytask-stata/Continuous%20Integration%20Workflow/main +.. image:: https://img.shields.io/github/workflow/status/pytask-dev/pytask-stata/main/main :target: https://github.com/pytask-dev/pytask-stata/actions?query=branch%3Amain .. image:: https://codecov.io/gh/pytask-dev/pytask-stata/branch/main/graph/badge.svg From 782d3b3a7555c7b359db19c5e0bdec45b15cdf6c Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Thu, 10 Mar 2022 14:12:55 +0100 Subject: [PATCH 3/3] rename yml. --- .../{continuous-integration-workflow.yml => main.yml} | 0 tests/test_parallel.py | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{continuous-integration-workflow.yml => main.yml} (100%) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/main.yml similarity index 100% rename from .github/workflows/continuous-integration-workflow.yml rename to .github/workflows/main.yml diff --git a/tests/test_parallel.py b/tests/test_parallel.py index 5344b53..2ca16f4 100644 --- a/tests/test_parallel.py +++ b/tests/test_parallel.py @@ -37,14 +37,14 @@ def task_execute_do_file(): tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source)) do_file = """ - sleep 2000 + sleep 4000 sysuse auto, clear save 1 """ tmp_path.joinpath("script_1.do").write_text(textwrap.dedent(do_file)) do_file = """ - sleep 2000 + sleep 4000 sysuse auto, clear save 2 """ @@ -83,7 +83,7 @@ def task_execute_do_file(): tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source)) do_file = """ - sleep 2000 + sleep 4000 sysuse auto, clear args produces save "`produces'"