Skip to content

Commit fe7bd84

Browse files
committed
Remove unnecessary hook.
1 parent 11e576b commit fe7bd84

File tree

3 files changed

+6
-39
lines changed

3 files changed

+6
-39
lines changed

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

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",

0 commit comments

Comments
 (0)