Closed QwistyS closed 4 years ago
There is no decorator for it, but you can control the execution order of your test by register to "tests_loaded" hook. See slash documentation cookbook about it: https://slash.readthedocs.io/en/master/cookbook.html#controlling-test-execution-order
There is no decorator for it, but you can control the execution order of your test by register to "tests_loaded" hook. See slash documentation cookbook about it: https://slash.readthedocs.io/en/master/cookbook.html#controlling-test-execution-order
Can I add a customer decorator to the test? Example @my_decorator def test_my_cool_test(): assert 1 == 1
yes, but if you want to use fixtures and other advanced features and your decorator does not return the original function it decorates, then things start to get complicated...
I'm assuming you are asking so that your decorator can attach some attribute to the test to sort by? If so, then yes, this is possible
yes, but if you want to use fixtures and other advanced features and your decorator does not return the original function it decorates, then things start to get complicated...
I'm assuming you are asking so that your decorator can attach some attribute to the test to sort by? If so, then yes, this is possible
Yes, my solution was to create a decorator for adding custom data to test metadata and create flow in "tests_loaded" hook to manage the overall test flow. Are you considering in the future to add flow capability?
Is it possible to add a policy to the test? for running some tests in order and some not ??? for example: ''' @slash.hooks.tests_loaded.register def tests_loaded(tests): for index, test in enumerate(reversed(tests)): if test.slash.get_group == TestGroup.ORDERED: test.slash.set_sort_key(index)
@slash.fixture def tests(): return slash.loader.Loader().get_runnables(file)
@slash.add_staff_toslash(group=TestGroup.UNORDERED, sort_key=None) def test_foo(some_fixture): assert 1 == 1
@slash.add_staff_toslash(group=TestGroup.ORDERED, sort_key=1) def test_foo_by_order1(some_fixture): assert 1 == 1
@slash.add_staff_toslash(group=TestGroup.ORDERED, sort_key=2) def test_foo_by_orde2r(some_fixture): assert 1 == 1 ''' I want test_foo_by_orde2r will run after test_foo_by_order1 and the rest of the tests will run whenever