Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
petya2164 committed May 13, 2019
1 parent 94d1d70 commit 7286b3e
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions wscript
Expand Up @@ -18,14 +18,7 @@ def options(opt):
default=None,
action="store",
help="Run all tests that include the substring specified."
"Wildcards not allowed. (Used with --run_tests)",
)

opt.add_option(
"--pytest_basetemp",
default="pytest_temp",
help="Set the basetemp folder where pytest executes the tests",
)
"Wildcards not allowed. (Used with --run_tests)")


def configure(conf):
Expand Down Expand Up @@ -109,23 +102,10 @@ def exec_test_pybind11(bld):
# Install pytest in the virtualenv
venv.run('python -m pip install pytest')

# We override the pytest temp folder with the basetemp option,
# so the test folders will be available at the specified location
# on all platforms.
basetemp = os.path.abspath(os.path.expanduser(
bld.options.pytest_basetemp))

# We need to manually remove the previously created basetemp folder,
# because pytest uses os.listdir in the removal process, and that fails
# if there are any broken symlinks in that folder.
if os.path.exists(basetemp):
waflib.extras.wurf.directory.remove_directory(path=basetemp)

testdir = bld.dependency_node("pybind11-source").find_node('tests')

# Use -B to avoid writing any .pyc files
command = 'python -B -m pytest {} --basetemp {}'.format(
testdir.abspath(), basetemp)
command = 'python -B -m pytest {}'.format(testdir.abspath())

# Adds the test filter if specified
if bld.options.test_filter:
Expand All @@ -142,9 +122,10 @@ def exec_test_pybind11(bld):
# tests = os.path.join(bld.dependency_path('pybind11-source'), 'tests')
# if os.path.exists(tests):
#for f in sorted(os.listdir('tests')):
# for f in ['test_class.py']:
# for f in ['test_iostream.py']:
# if f.endswith('.py'):
# test = os.path.join(tests, f)
# bld.cmd_and_log('{0} {1}\n'.format(python, test), env=env)
# bld.cmd_and_log(
# '{0} -B -m pytest {1}\n'.format(python, test), env=env)


0 comments on commit 7286b3e

Please sign in to comment.