From 1c0628406e3ee3cc58d9c379980784cbf5a4947a Mon Sep 17 00:00:00 2001 From: Ashley Camba Garrido Date: Tue, 10 Oct 2017 15:21:33 +0200 Subject: refactor(tests) Use marker to skip tests that depend on a git repo --- conftest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'conftest.py') diff --git a/conftest.py b/conftest.py index 2475876..53a8b88 100644 --- a/conftest.py +++ b/conftest.py @@ -61,4 +61,11 @@ def mytest_model(): @pytest.fixture(scope='function', autouse=False) def user_instance(request, admin_user): - request.cls.user = admin_user \ No newline at end of file + request.cls.user = admin_user + + +@pytest.fixture(autouse=True) +def has_git_requirements(request, project_root): + if request.node.get_marker('has_git_requirements'): + if not os.path.exists(os.path.join(project_root, '.git', 'refs', 'heads', 'master')): + pytest.skip('skipped test as project is not a git repo') -- cgit v1.2.1