Skip to content

Commit 366d39d

Browse files
committed
Remove unnecessary hook.
1 parent 238e002 commit 366d39d

File tree

3 files changed

+6
-38
lines changed

3 files changed

+6
-38
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-r>`_ and
77
`Anaconda.org <https://anaconda.org/conda-forge/pytask-r>`_.
88

99

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

src/pytask_r/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

1715

@@ -35,23 +33,6 @@ def run_r_script(r):
3533
subprocess.run(r, check=True)
3634

3735

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

tests/test_collect.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from pytask_r.collect import _get_node_from_dictionary
1010
from pytask_r.collect import _merge_all_markers
1111
from pytask_r.collect import _prepare_cmd_options
12-
from pytask_r.collect import pytask_collect_task
1312
from pytask_r.collect import pytask_collect_task_teardown
1413
from pytask_r.collect import r
1514

@@ -57,24 +56,6 @@ def test_merge_all_markers(marks, expected):
5756
assert out == expected
5857

5958

60-
@pytest.mark.unit
61-
@pytest.mark.parametrize(
62-
"name, expected",
63-
[("task_dummy", True), ("invalid_name", None)],
64-
)
65-
def test_pytask_collect_task(name, expected):
66-
session = DummyClass()
67-
path = Path("some_path")
68-
task_dummy.pytaskmark = [Mark("r", (), {})]
69-
70-
task = pytask_collect_task(session, path, name, task_dummy)
71-
72-
if expected:
73-
assert task
74-
else:
75-
assert not task
76-
77-
7859
@pytest.mark.unit
7960
@pytest.mark.parametrize(
8061
"depends_on, produces, expectation",

0 commit comments

Comments
 (0)