Skip to content

Commit

Permalink
Merge pull request morganstanley#147 from ryan-collingham/rlc/move_tests
Browse files Browse the repository at this point in the history
Move test/ -> tests/ to avoid name clash with stdlib
  • Loading branch information
ryan-collingham authored Apr 12, 2019
2 parents 8ec49b3 + 094df3d commit 1e29862
Show file tree
Hide file tree
Showing 147 changed files with 15 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ install:

script:
- pylint --rcfile pylintrc testplan
- pytest test --verbose
- pytest tests --verbose

6 changes: 3 additions & 3 deletions doc/en/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,13 @@ tests. Some tests may be skipped due to optional dependency packages

.. code-block:: text
cd test
cd tests
# Unit tests.
py.test unit --verbose
pytest unit --verbose
# Functional tests.
py.test functional --verbose
pytest functional --verbose
Writing custom drivers
Expand Down
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 1e29862

Please sign in to comment.