Skip to content

Commit

Permalink
Pass arbitrary options to doctest in 'run_development_cycle.sh'
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquev6 committed Oct 16, 2023
1 parent 5031f49 commit 78cfc81
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions development/cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,13 @@
)
@click.option(
"--forbid-chrones", is_flag=True,
help=textwrap.dedent("Build lincs without Chrones."),
help="Build lincs without Chrones.",
)
def main(with_docs, single_python_version, unit_coverage, skip_long, stop_after_unit, forbid_gpu, forbid_chrones):
@click.option(
"--doctest-option", multiple=True,
help="Pass an option verbatim to doctest. Can be used multiple times.",
)
def main(with_docs, single_python_version, unit_coverage, skip_long, stop_after_unit, forbid_gpu, forbid_chrones, doctest_option):
if forbid_gpu:
os.environ["LINCS_DEV_FORBID_GPU"] = "true"
os.environ["LINCS_DEV_FORBID_NVCC"] = "true"
Expand Down Expand Up @@ -94,7 +98,7 @@ def main(with_docs, single_python_version, unit_coverage, skip_long, stop_after_
print()

print_title("Running C++ unit tests")
run_cpp_tests(python_version=python_versions[0])
run_cpp_tests(python_version=python_versions[0], doctest_options=doctest_option)
print()

for python_version in python_versions:
Expand Down Expand Up @@ -153,7 +157,7 @@ def print_title(title, under="="):
print(flush=True)


def run_cpp_tests(*, python_version,):
def run_cpp_tests(*, python_version, doctest_options):
suffix = "m" if int(python_version.split(".")[1]) < 8 else ""
subprocess.run(
[
Expand All @@ -165,11 +169,11 @@ def run_cpp_tests(*, python_version,):
)
env = dict(os.environ)
env["LD_LIBRARY_PATH"] = "."
subprocess.run(
["/tmp/lincs-tests"] + (["-d"] if os.environ.get("LINCS_DEV_SKIP_LONG", "false") == "false" else []),
check=True,
env=env,
)
command = ["/tmp/lincs-tests"]
if os.environ.get("LINCS_DEV_SKIP_LONG", "false") == "false":
command += ["-d"]
command += list(doctest_options)
subprocess.run(command, check=True, env=env)


def run_python_tests(*, python_version):
Expand Down
2 changes: 1 addition & 1 deletion run-development-cycle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ do
--forbid-gpu)
forbid_gpu=true;;
*)
cycle_arguments+=($1);;
cycle_arguments+=("$1");;
esac
shift
done
Expand Down

0 comments on commit 78cfc81

Please sign in to comment.