Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX pytest configuration for v7.1 #300

Merged
merged 1 commit into from Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 10 additions & 6 deletions benchopt/cli/main.py
Expand Up @@ -299,7 +299,14 @@ def install(benchmark, solver_names, dataset_names, force=False,
'a temporary one is created for the test.')
@click.argument('pytest_args', nargs=-1, type=click.UNPROCESSED)
def test(benchmark, env_name, pytest_args):
pytest_args = ' '.join(pytest_args)

from benchopt.tests import __file__ as _bench_test_module
_bench_test_module = Path(_bench_test_module).parent

pytest_args = ' '.join((
"-p benchopt.tests.fixtures", f"--rootdir {_bench_test_module}",
*pytest_args
))
if len(pytest_args) == 0:
pytest_args = '-vl'

Expand All @@ -314,13 +321,10 @@ def test(benchmark, env_name, pytest_args):
)
env_option = f'--test-env {env_name}'

from benchopt.tests import __file__ as _bench_test_module
BENCHMARK_TEST_FILE = (
Path(_bench_test_module).parent / "test_benchmarks.py"
)
_bench_test_file = _bench_test_module / "test_benchmarks.py"

cmd = (
f'pytest {pytest_args} {BENCHMARK_TEST_FILE} '
f'pytest {pytest_args} {_bench_test_file} '
f'--benchmark {benchmark} {env_option} '
# Make sure to not modify sys.path to add test file from current env
# in sub conda env as there might be different python versions.
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion conftest.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -12,7 +12,7 @@ local_scheme = "no-local-version"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-v"
addopts = "-v -p benchopt.tests.fixtures"
testpaths = [
"benchopt",
]
Expand Down