Skip to content

Commit 9fd344b

Browse files
authored
Remove unnecessary hook. (#20)
1 parent 11e576b commit 9fd344b

File tree

6 files changed

+11
-44
lines changed

6 files changed

+11
-44
lines changed

.github/workflows/continuous-integration-workflow.yml renamed to .github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Continuous Integration Workflow
1+
name: main
22

33
# Automatically cancel a previous run.
44
concurrency:

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ all releases are available on `PyPI <https://pypi.org/project/pytask-stata>`_ an
77
`Anaconda.org <https://anaconda.org/conda-forge/pytask-stata>`_.
88

99

10+
0.2.0 - 2022-xx-xx
11+
------------------
12+
13+
- :gh`:`20` removes an unnecessary hook implementation.
14+
15+
1016
0.1.2 - 2022-02-08
1117
------------------
1218

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
:alt: PyPI - License
1717
:target: https://pypi.org/project/pytask-stata
1818

19-
.. image:: https://img.shields.io/github/workflow/status/pytask-dev/pytask-stata/Continuous%20Integration%20Workflow/main
19+
.. image:: https://img.shields.io/github/workflow/status/pytask-dev/pytask-stata/main/main
2020
:target: https://github.com/pytask-dev/pytask-stata/actions?query=branch%3Amain
2121

2222
.. image:: https://codecov.io/gh/pytask-dev/pytask-stata/branch/main/graph/badge.svg

src/pytask_stata/collect.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99

1010
from _pytask.config import hookimpl
1111
from _pytask.mark_utils import get_specific_markers_from_task
12-
from _pytask.mark_utils import has_marker
1312
from _pytask.nodes import FilePathNode
14-
from _pytask.nodes import PythonFunctionTask
1513
from _pytask.parametrize import _copy_func
1614
from pytask_stata.shared import convert_task_id_to_name_of_log_file
1715
from pytask_stata.shared import get_node_from_dictionary
@@ -37,23 +35,6 @@ def run_stata_script(stata, cwd):
3735
subprocess.run(stata, cwd=cwd, check=True)
3836

3937

40-
@hookimpl
41-
def pytask_collect_task(session, path, name, obj):
42-
"""Collect a task which is a function.
43-
44-
There is some discussion on how to detect functions in this `thread
45-
<https://stackoverflow.com/q/624926/7523785>`_. :class:`types.FunctionType` does not
46-
detect built-ins which is not possible anyway.
47-
48-
"""
49-
if name.startswith("task_") and callable(obj) and has_marker(obj, "stata"):
50-
task = PythonFunctionTask.from_path_name_function_session(
51-
path, name, obj, session
52-
)
53-
54-
return task
55-
56-
5738
@hookimpl
5839
def pytask_collect_task_teardown(session, task):
5940
"""Perform some checks and prepare the task function."""

tests/test_collect.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from _pytask.nodes import FilePathNode
99
from pytask_stata.collect import _merge_all_markers
1010
from pytask_stata.collect import _prepare_cmd_options
11-
from pytask_stata.collect import pytask_collect_task
1211
from pytask_stata.collect import pytask_collect_task_teardown
1312
from pytask_stata.collect import stata
1413
from pytask_stata.shared import get_node_from_dictionary
@@ -97,25 +96,6 @@ def test_prepare_cmd_options(args, stata_source_key, platform):
9796
assert result == expected
9897

9998

100-
@pytest.mark.unit
101-
@pytest.mark.parametrize(
102-
"name, expected",
103-
[("task_dummy", True), ("invalid_name", None)],
104-
)
105-
def test_pytask_collect_task(name, expected):
106-
session = DummyClass()
107-
session.config = {"stata": "stata"}
108-
path = Path("some_path")
109-
task_dummy.pytaskmark = [Mark("stata", (), {})]
110-
111-
task = pytask_collect_task(session, path, name, task_dummy)
112-
113-
if expected:
114-
assert task
115-
else:
116-
assert not task
117-
118-
11999
@pytest.mark.unit
120100
@pytest.mark.parametrize(
121101
"depends_on, produces, expectation",

tests/test_parallel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ def task_execute_do_file():
3737
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
3838

3939
do_file = """
40-
sleep 2000
40+
sleep 4000
4141
sysuse auto, clear
4242
save 1
4343
"""
4444
tmp_path.joinpath("script_1.do").write_text(textwrap.dedent(do_file))
4545

4646
do_file = """
47-
sleep 2000
47+
sleep 4000
4848
sysuse auto, clear
4949
save 2
5050
"""
@@ -83,7 +83,7 @@ def task_execute_do_file():
8383
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
8484

8585
do_file = """
86-
sleep 2000
86+
sleep 4000
8787
sysuse auto, clear
8888
args produces
8989
save "`produces'"

0 commit comments

Comments
 (0)