From a934eb063c11e3b6e55a605ee0db62b381039415 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 13 Oct 2020 14:49:31 -0400 Subject: [PATCH] Factor `repodir()` helper into conftest.py --- tests/conftest.py | 10 ++++++++++ tests/test_debugger.py | 2 +- tests/test_docs_examples.py | 10 +--------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 6a9f938..347cc7d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -39,6 +39,16 @@ no_windows = pytest.mark.skipif( ) +def repodir(): + """Return the abspath to the repo directory. + """ + dirname = os.path.dirname + dirpath = os.path.abspath( + dirname(dirname(os.path.realpath(__file__))) + ) + return dirpath + + def pytest_addoption(parser): parser.addoption( "--ll", action="store", dest='loglevel', diff --git a/tests/test_debugger.py b/tests/test_debugger.py index 071febf..fe357e8 100644 --- a/tests/test_debugger.py +++ b/tests/test_debugger.py @@ -9,7 +9,7 @@ from os import path import pytest import pexpect -from .test_docs_examples import repodir +from conftest import repodir # TODO: diff --git a/tests/test_docs_examples.py b/tests/test_docs_examples.py index 67b34ee..73e6a69 100644 --- a/tests/test_docs_examples.py +++ b/tests/test_docs_examples.py @@ -11,15 +11,7 @@ import shutil import pytest - -def repodir(): - """Return the abspath to the repo directory. - """ - dirname = os.path.dirname - dirpath = os.path.abspath( - dirname(dirname(os.path.realpath(__file__))) - ) - return dirpath +from conftest import repodir def examples_dir():