Skip to content

Commit 13f97b7

Browse files
authored
Release v0.0.4 and fix pytask_collect_task_teardown. (#4)
1 parent 70fda0a commit 13f97b7

File tree

6 files changed

+46
-4
lines changed

6 files changed

+46
-4
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ chronological order. Releases follow `semantic versioning <https://semver.org/>`
66
all releases are available on `Anaconda.org <https://anaconda.org/pytask/pytask-r>`_.
77

88

9+
0.0.4 - 2020-10-14
10+
------------------
11+
12+
- :gh:`4` fixes ``pytask_collect_task_teardown`` with non-R tasks and releases 0.0.4.
13+
14+
915
0.0.3 - 2020-10-04
1016
------------------
1117

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.0.3
2+
current_version = 0.0.4
33
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+))(\-?((dev)?(?P<dev>\d+))?)
44
serialize =
55
{major}.{minor}.{patch}dev{dev}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name="pytask-r",
6-
version="0.0.3",
6+
version="0.0.4",
77
packages=find_packages(where="src"),
88
package_dir={"": "src"},
99
entry_points={"pytask": ["pytask_r = pytask_r.plugin"]},

src/pytask_r/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.3"
1+
__version__ = "0.0.4"

src/pytask_r/collect.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ def pytask_collect_task(session, path, name, obj):
6464

6565
@hookimpl
6666
def pytask_collect_task_teardown(task):
67-
if task is not None:
67+
"""Perform some checks.
68+
69+
Remove is task is none check with pytask 0.0.9.
70+
71+
"""
72+
if task is not None and get_specific_markers_from_task(task, "r"):
6873
if isinstance(task.depends_on[0], FilePathNode) and task.depends_on[
6974
0
7075
].value.suffix not in [".r", ".R"]:

tests/test_execute.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import itertools
12
import os
23
import textwrap
34
from contextlib import ExitStack as does_not_raise # noqa: N813
@@ -13,6 +14,36 @@ class DummyTask:
1314
pass
1415

1516

17+
@pytest.mark.end_to_end
18+
@pytest.mark.parametrize(
19+
"dependencies, products",
20+
itertools.product(
21+
([], ["in.txt"], ["in_1.txt", "in_2.txt"]),
22+
(["out.txt"], ["out_1.txt", "out_2.txt"]),
23+
),
24+
)
25+
def test_normal_flow_w_varying_dependencies_products(tmp_path, dependencies, products):
26+
source = f"""
27+
import pytask
28+
from pathlib import Path
29+
30+
31+
@pytask.mark.depends_on({dependencies})
32+
@pytask.mark.produces({products})
33+
def task_dummy(depends_on, produces):
34+
if not isinstance(produces, list):
35+
produces = [produces]
36+
for product in produces:
37+
product.touch()
38+
"""
39+
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
40+
for dependency in dependencies:
41+
tmp_path.joinpath(dependency).touch()
42+
43+
session = main({"paths": tmp_path})
44+
assert session.exit_code == 0
45+
46+
1647
@pytest.mark.unit
1748
@pytest.mark.parametrize(
1849
"found_r, expectation",

0 commit comments

Comments
 (0)