Skip to content

Commit 5ef6253

Browse files
committed
Update test suite.
1 parent 76154b9 commit 5ef6253

File tree

2 files changed

+31
-32
lines changed

2 files changed

+31
-32
lines changed

tests/test_execute.py

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ def test_run_jl_script( # noqa: PLR0913
4949
depends_on,
5050
):
5151
task_source = f"""
52-
import pytask
52+
from pytask import task, mark
53+
from pathlib import Path
5354
54-
@pytask.mark.julia(
55-
script="script.jl",
55+
@task(kwargs={{"depends_on": {depends_on}, "produces": "out.txt"}})
56+
@mark.julia(
57+
script=Path("script.jl"),
5658
serializer="{serializer}",
5759
suffix="{suffix}",
5860
project="{ROOT.as_posix()}",
5961
)
60-
@pytask.mark.depends_on({depends_on})
61-
@pytask.mark.produces("out.txt")
6262
def task_run_jl_script():
6363
pass
6464
"""
@@ -92,16 +92,15 @@ def test_run_jl_script_w_task_decorator(
9292
runner, tmp_path, parse_config_code, serializer, suffix
9393
):
9494
task_source = f"""
95-
import pytask
95+
from pytask import mark, task
9696
97-
@pytask.mark.task
98-
@pytask.mark.julia(
97+
@task(kwargs={{"produces": "out.txt"}})
98+
@mark.julia(
9999
script="script.jl",
100100
serializer="{serializer}",
101101
suffix="{suffix}",
102102
project="{ROOT.as_posix()}"
103103
)
104-
@pytask.mark.produces("out.txt")
105104
def run_jl_script():
106105
pass
107106
"""
@@ -133,15 +132,15 @@ def test_raise_error_if_julia_is_not_found(
133132
suffix,
134133
):
135134
task_source = f"""
136-
import pytask
135+
from pytask import mark, task
137136
138-
@pytask.mark.julia(
137+
@task(kwargs={{"produces": "out.txt"}})
138+
@mark.julia(
139139
script="script.jl",
140140
serializer="{serializer}",
141141
suffix="{suffix}",
142142
project="{ROOT.as_posix()}",
143143
)
144-
@pytask.mark.produces("out.txt")
145144
def task_run_jl_script():
146145
pass
147146
"""
@@ -179,16 +178,16 @@ def test_run_jl_script_w_wrong_cmd_option(
179178
suffix,
180179
):
181180
task_source = f"""
182-
import pytask
181+
from pytask import mark, task
183182
184-
@pytask.mark.julia(
183+
@task(kwargs={{"produces": "out.txt"}})
184+
@mark.julia(
185185
script="script.jl",
186186
options=("--wrong-flag"),
187187
serializer="{serializer}",
188188
suffix="{suffix}",
189189
project="{ROOT.as_posix()}",
190190
)
191-
@pytask.mark.produces("out.txt")
192191
def task_run_jl_script():
193192
pass
194193
@@ -220,16 +219,16 @@ def test_check_passing_cmd_line_options( # noqa: PLR0913
220219
suffix,
221220
):
222221
task_source = f"""
223-
import pytask
222+
from pytask import mark, task
224223
225-
@pytask.mark.julia(
224+
@task(kwargs={{"produces": "out.txt"}})
225+
@mark.julia(
226226
script="script.jl",
227227
options=("--threads", "{n_threads}"),
228228
serializer="{serializer}",
229229
suffix="{suffix}",
230230
project="{ROOT.as_posix()}"
231231
)
232-
@pytask.mark.produces("out.txt")
233232
def task_run_jl_script():
234233
pass
235234
@@ -265,14 +264,14 @@ def test_run_jl_script_w_environment_in_config( # noqa: PLR0913
265264
path,
266265
):
267266
task_source = f"""
268-
import pytask
267+
from pytask import mark, task
269268
270-
@pytask.mark.julia(
269+
@task(kwargs={{"produces": "out.txt"}})
270+
@mark.julia(
271271
script="script.jl",
272272
serializer="{serializer}",
273273
suffix="{suffix}",
274274
)
275-
@pytask.mark.produces("out.txt")
276275
def task_run_jl_script():
277276
pass
278277
"""
@@ -319,15 +318,15 @@ def test_run_jl_script_w_environment_relative_to_task(
319318
project_in_task = Path(os.path.relpath(ROOT, tmp_path)).as_posix()
320319

321320
task_source = f"""
322-
import pytask
321+
from pytask import mark, task
323322
324-
@pytask.mark.julia(
323+
@task(kwargs={{"produces": "out.txt"}})
324+
@mark.julia(
325325
script="script.jl",
326326
serializer="{serializer}",
327327
suffix="{suffix}",
328328
project="{project_in_task}",
329329
)
330-
@pytask.mark.produces("out.txt")
331330
def task_run_jl_script():
332331
pass
333332
"""
@@ -352,15 +351,15 @@ def task_run_jl_script():
352351
@pytest.mark.end_to_end()
353352
def test_run_jl_script_w_custom_serializer(runner, tmp_path):
354353
task_source = f"""
355-
import pytask
354+
from pytask import mark, task
356355
import json
357356
358-
@pytask.mark.julia(
357+
@task(kwargs={{"produces": "out.txt"}})
358+
@mark.julia(
359359
script="script.jl",
360360
serializer=json.dumps,
361361
project="{ROOT.as_posix()}",
362362
)
363-
@pytask.mark.produces("out.txt")
364363
def task_run_jl_script():
365364
pass
366365
"""
@@ -385,11 +384,11 @@ def task_run_jl_script():
385384
@pytest.mark.end_to_end()
386385
def test_run_jl_script_fails_w_multiple_markers(runner, tmp_path):
387386
task_source = """
388-
import pytask
387+
from pytask import mark, task
389388
390-
@pytask.mark.julia(script="script.jl")
391-
@pytask.mark.julia(script="script.jl")
392-
@pytask.mark.produces("out.txt")
389+
@task(kwargs={"produces": "out.txt"})
390+
@mark.julia(script="script.jl")
391+
@mark.julia(script="script.jl")
393392
def task_run_jl_script():
394393
pass
395394
"""

tests/test_normal_execution_w_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_execution_w_varying_dependencies_products(
2222
import pytask
2323
from pathlib import Path
2424
25-
def task_dummy(
25+
def task_example(
2626
depends_on=[Path(p) for p in {dependencies}],
2727
produces=[Path(p) for p in {products}],
2828
):

0 commit comments

Comments
 (0)