This repository was archived by the owner on May 29, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +35
-1
lines changed
Expand file tree Collapse file tree 1 file changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ def test_1():
237237 raise Exception('Failed to load test file')
238238 """ )
239239 result = testdir .runpytest (* cli_args )
240- result .assert_outcomes (error = 1 )
240+ result .assert_outcomes (errors = 1 )
241241 # Expect error code 2 (Interrupted), which is returned on collection error.
242242 assert result .ret == 2
243243
@@ -258,3 +258,37 @@ def test_collection_collectonly(testdir, cli_args):
258258 ])
259259 result .assert_outcomes ()
260260 assert result .ret == 0
261+
262+
263+ @pytest .mark .parametrize ('cli_args' , [
264+ ['--workers=4' ],
265+ ['--tests-per-worker=4' ]
266+ ])
267+ def test_sequenced_call (testdir , cli_args ):
268+ """
269+ Tests, that sequenced tests will be called in sequence.
270+ """
271+ testdir .makepyfile ("""
272+ import pytest
273+ import time
274+
275+ obj = {"a": None}
276+
277+ @pytest.mark.sequence
278+ def test_1():
279+ assert obj["a"] == None
280+ obj["a"] = "first"
281+
282+ @pytest.mark.sequence
283+ def test_2():
284+ time.sleep(0.1)
285+ assert obj["a"] == "first"
286+ obj["a"] = "second"
287+
288+ @pytest.mark.sequence
289+ def test_3():
290+ assert obj["a"] == "second"
291+ """ )
292+ result = testdir .runpytest (* cli_args )
293+ result .assert_outcomes (passed = 3 )
294+ assert result .ret == 0
You can’t perform that action at this time.
0 commit comments