10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-02 11:25:26 +02:00

qp_test can run only one test

This commit is contained in:
Anthony Scemama 2019-01-04 03:19:20 +01:00
parent 0ee16e8d85
commit c297dbef83
6 changed files with 31 additions and 11 deletions

View File

@ -11,10 +11,13 @@ BUILDDIR = build
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
.PHONY: help Makefile auto
auto:
cd source ; python2 auto_generate.py
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
cd source ; python2 auto_generate.py
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -4,14 +4,17 @@
qp_test
=======
This command runs the consistency test of |qp|. The tests are run with the |Bats| shell testing environment.
This command runs the consistency test of |qp|.
The tests are run with the |Bats| shell testing environment.
If the name of a test of its number is specified on the command line, only this
test will be run.
Usage
-----
.. code:: bash
qp_test [FLAGS]
qp_test [FLAGS] [TEST]
Flags :
[-a] Run all the tests
[-v] Verbose mode: shows the output of the runs

View File

@ -5,7 +5,7 @@
Runs all the possible tests using bats.
Usage:
qp_test [-av]
qp_test [-av] [TEST]
Options:
-v verbose output
@ -34,6 +34,9 @@ def main(arguments):
number, _ = f.split('.',1)
l_bats.append( (int(number), os.path.join(dirname,f)) )
if arguments["TEST"]:
os.environ["TEST"] = arguments["TEST"]
if arguments["-a"]:
for (dirname, _, filenames) in os.walk(QP_SRC, followlinks=False) :
if "IRPF90_temp" not in dirname:
@ -55,12 +58,12 @@ def main(arguments):
print ""
if arguments["-v"]:
p1 = subprocess.Popen(["python2", "bats_to_sh.py", bats_file], \
stdout=subprocess.PIPE)
p2 = subprocess.Popen(["bash"], stdin=p1.stdout)
stdout=subprocess.PIPE, env=os.environ)
p2 = subprocess.Popen(["bash"], stdin=p1.stdout, env=os.environ)
_, _ = os.waitpid(p2.pid,0)
_, _ = os.waitpid(p1.pid,0)
else:
subprocess.check_call(["bats", bats_file])
subprocess.check_call(["bats", bats_file], env=os.environ)

View File

@ -29,7 +29,7 @@ function run() {
@test "[Cu(NH3)4]2+" {
qp_set_mo_class cu_nh3_4_2plus.ezfio -core "[1-24]" -act "[25-45]" -del "[46-87]"
run cu_nh3_4_2plus.ezfio -1862.98687225779 -1862.68821075043
run cu_nh3_4_2plus.ezfio -1862.98685486633 -1862.68819645070
}
@test "C2H2" {
@ -70,7 +70,7 @@ function run() {
@test "CH4" {
qp_set_mo_class ch4.ezfio -core "[1]" -act "[2-30]" -del "[31-59]"
run ch4.ezfio -40.2403957502264 -39.8433160343413
run ch4.ezfio -40.2403916878857 -39.8433229646061
}
@test "CO2" {

View File

@ -44,3 +44,14 @@ function test_exe() {
fi
}
run_only_test() {
if [[ "$BATS_TEST_DESCRIPTION" != "$1" ]] && [[ "$BATS_TEST_NUMBER" -ne "$1" ]]; then
skip
fi
}
setup() {
if [[ -n $TEST ]] ; then
run_only_test $TEST
fi
}

View File

@ -13,7 +13,7 @@ for i in raw_data:
if i == "@":
inside = True
elif i == "{" and inside and level == 0:
new_i = ""
new_i = "\nsetup\n"
elif i == "}" and inside and level == 1:
inside = False
new_i = ""