From bd7a7f7bc16d57f95a266caf9ffb086e7ba120d6 Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Thu, 7 Nov 2019 18:13:33 +0100 Subject: [PATCH] tests: specify custom order of tests for faster feedback and execution of slower tests at the end. --- rhodecode/tests/plugin.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/rhodecode/tests/plugin.py b/rhodecode/tests/plugin.py index 8895cddf..0e18f7e9 100644 --- a/rhodecode/tests/plugin.py +++ b/rhodecode/tests/plugin.py @@ -118,6 +118,20 @@ def pytest_collection_modifyitems(session, config, items): i for i in items if getattr(i.obj, '__test__', True)] items[:] = remaining + # NOTE(marcink): custom test ordering, db tests and vcstests are slowes and should + # be executed at the end for faster test feedback + def sorter(item): + pos = 0 + key = item._nodeid + if key.startswith('rhodecode/tests/database'): + pos = 1 + elif key.startswith('rhodecode/tests/vcs_operations'): + pos = 2 + + return pos + + items.sort(key=sorter) + def pytest_generate_tests(metafunc):