|
1 | 1 | #!/usr/bin/env python
|
2 | 2 | ##############################################################################
|
3 | 3 | #
|
4 |
| -# (c) 2024 The Trustees of Columbia University in the City of New York. |
5 |
| -# All rights reserved. |
| 4 | +# diffpy.srfit by DANSE Diffraction group |
| 5 | +# Simon J. L. Billinge |
| 6 | +# (c) 2010 The Trustees of Columbia University |
| 7 | +# in the City of New York. All rights reserved. |
6 | 8 | #
|
7 |
| -# File coded by: Billinge Group members and community contributors. |
| 9 | +# File coded by: Pavol Juhas |
8 | 10 | #
|
9 |
| -# See GitHub contributions for a more detailed list of contributors. |
10 |
| -# https://github.com/diffpy/diffpy.srfit/graphs/contributors |
11 |
| -# |
12 |
| -# See LICENSE.rst for license information. |
| 11 | +# See AUTHORS.txt for a list of people who contributed. |
| 12 | +# See LICENSE_DANSE.txt for license information. |
13 | 13 | #
|
14 | 14 | ##############################################################################
|
| 15 | + |
15 | 16 | """Convenience module for executing all unit tests with
|
| 17 | +
|
16 | 18 | python -m diffpy.srfit.tests.run
|
17 | 19 | """
|
18 | 20 |
|
19 |
| -import sys |
20 |
| - |
21 |
| -import pytest |
22 | 21 |
|
23 |
| -if __name__ == "__main__": |
24 |
| - # show output results from every test function |
25 |
| - args = ["-v"] |
26 |
| - # show the message output for skipped and expected failure tests |
27 |
| - if len(sys.argv) > 1: |
28 |
| - args.extend(sys.argv[1:]) |
29 |
| - print("pytest arguments: {}".format(args)) |
30 |
| - # call pytest and exit with the return code from pytest |
31 |
| - exit_res = pytest.main(args) |
32 |
| - sys.exit(exit_res) |
| 22 | +if __name__ == '__main__': |
| 23 | + import sys |
| 24 | + # show warnings by default |
| 25 | + if not sys.warnoptions: |
| 26 | + import os, warnings |
| 27 | + warnings.simplefilter("default") |
| 28 | + # also affect subprocesses |
| 29 | + os.environ["PYTHONWARNINGS"] = "default" |
| 30 | + from diffpy.srfit.tests import test |
| 31 | + # produce zero exit code for a successful test |
| 32 | + sys.exit(not test().wasSuccessful()) |
33 | 33 |
|
34 | 34 | # End of file
|
0 commit comments