Skip to content

Commit

Permalink
Move test/ -> tests/ to avoid name clash with stdlib
Browse files Browse the repository at this point in the history
Importing fom the "test" namespace can cause problems due to clashing
with the standard library "test" package
(https://docs.python.org/3/library/test.html). Renaming to "tests" is
common practice and avoids this clash.
  • Loading branch information
ryan-collingham committed Apr 12, 2019
1 parent 5b44c44 commit ac2aa64
Show file tree
Hide file tree
Showing 145 changed files with 11 additions and 28 deletions.

This file was deleted.

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
import platform


FILE_DIR = os.path.dirname(__file__)
_FILE_DIR = os.path.dirname(__file__)

# This file is under tests/functional/examples, so the root directory is 3
# levels up.
_REPO_ROOT = os.path.abspath(os.path.join(
_FILE_DIR, *(os.pardir for _ in range(3))))
_EXAMPLES_ROOT = os.path.join(_REPO_ROOT, 'examples')

ON_WINDOWS = platform.system() == 'Windows'

Expand Down Expand Up @@ -52,33 +58,12 @@ def _param_formatter(param):
return repr(param)


def _examples_root():
"""
Find the examples directory that sits next to test & testplan
"""

cwd = FILE_DIR
while True:
contents = os.listdir(cwd)
if all([entry in contents for entry in ROOT_DIR_CONTENTS]):
break
parent_dir = os.path.dirname(cwd)
if os.path.realpath(cwd) == os.path.realpath(parent_dir):
raise RuntimeError('Could not find repo directory')
cwd = parent_dir

return os.path.abspath(os.path.join(
cwd,
'examples'
))


@pytest.mark.parametrize(
'root,filename',
[
(os.path.abspath(root), filename)
for root, _, files in os.walk(
_examples_root(), followlinks=True)
_EXAMPLES_ROOT, followlinks=True)
for filename in files
if ('test_plan' in filename and filename.endswith('.py'))
],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from testplan.common.utils.testing import log_propagation_disabled
from testplan.common.utils.logger import TESTPLAN_LOGGER

from test.functional.testplan import func_basic_tasks
from tests.functional.testplan import func_basic_tasks


class MyTestRunner(TestRunner):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from testplan.common.utils.logger import TESTPLAN_LOGGER
from testplan.testing.cpp import GTest

from test.functional.testplan.testing.fixtures.cpp import gtest
from tests.functional.testplan.testing.fixtures.cpp import gtest

fixture_root = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from testplan.common.utils.logger import TESTPLAN_LOGGER
from testplan.testing.cpp import HobbesTest

from test.functional.testplan.testing.fixtures.cpp import hobbestest
from tests.functional.testplan.testing.fixtures.cpp import hobbestest

fixture_root = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ac2aa64

Please sign in to comment.