Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions ORE-SWIG/runPythonTests.cmd
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
set PYTHONPATH=%PYTHONPATH%;%~dp0\OREAnalytics-SWIG\Python\build;%~dp0\OREAnalytics-SWIG\Python\build\Release
@echo off
setlocal

REM Run the Python test suites against a locally built ORE module.
REM Picks up the setup.py build output; harmless no-op if you installed
REM the package instead with `python setup.py install`.
for /d %%d in ("%~dp0build\lib.*") do set "PYTHONPATH=%PYTHONPATH%;%%d"

cd /d "%~dp0test"

echo RUN ORE Python Testsuite
cd %~dp0\OREAnalytics-SWIG\Python\Test
python OREAnalyticsTestSuite.py
pause
if errorlevel 1 exit /b 1

REM testrunner.py aliases QuantLib to ORE before collection, which the
REM QuantLib-SWIG tests require; they import QuantLib, not ORE
echo RUN QuantLib Testsuite
cd %~dp0\QuantLib-SWIG\Python\test
python -c "import sys, ORE; sys.modules['QuantLib']=ORE;import QuantLibTestSuite;QuantLibTestSuite.test()"
pause
python testrunner.py
if errorlevel 1 exit /b 1

cd %~dp0\
echo All Python test suites passed
9 changes: 7 additions & 2 deletions ORE-SWIG/test/OREAnalyticsTestSuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
import pytest
import ORE

if __name__ == '__main__':
def test():
print('testing ORED ' + ORE.__version__)
sys.exit(pytest.main([os.path.dirname(__file__)]))
exit_code = pytest.main([os.path.dirname(os.path.abspath(__file__))])
if exit_code != 0:
sys.exit(exit_code)


if __name__ == '__main__':
test()
8 changes: 6 additions & 2 deletions ORE-SWIG/test/testrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

sys.modules["QuantLib"] = ORE

QUANTLIB_TESTS = os.path.join(os.path.dirname(os.path.abspath(__file__)),
os.pardir, "QuantLib-SWIG", "Python", "test")

if __name__=="__main__":
pytest_args = sys.argv[1:] or ["../QuantLibTestSuite"]
pytest_args = sys.argv[1:] or [QUANTLIB_TESTS]
ret_code = pytest.main(pytest_args)
print("PyTest Return Code: ", ret_code)
print("PyTest Return Code: ", ret_code)
sys.exit(ret_code)
2 changes: 1 addition & 1 deletion ORE-SWIG/tutorials.03.build_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ setup.py.
python -m venv env1
.\env1\Scripts\activate.bat
python -m pip install --upgrade pip
python -m pip install build pynose pytest setuptools
python -m pip install build pytest setuptools
python setup.py wrap
python setup.py build
python setup.py test
Expand Down
2 changes: 1 addition & 1 deletion tutorials/tutorials.030.docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Invoke the command below to run the docker container interactively:
Here are the commands to run the examples:

cd /ore/Examples
python3 run_examples_testsuite.py --with-xunitmp --xunitmp-file=examples.xml --processes=8 --process-timeout=3600
pytest run_examples_testsuite.py --junitxml=examples.xml -n 8 --timeout=3600

Here are the commands to run all of the unit tests in parallel:

Expand Down