Skip to content

Commit

Permalink
MAINT, TST: remove usage of test.support (#33)
Browse files Browse the repository at this point in the history
* the `test` package in CPython is intended for internal
use by the CPython development team only, and is subject
to API changes without prior deprecation, as noted here:
https://docs.python.org/3.11/library/test.html

* `test.support.run_unittest` is not available in Python
`3.11.7`, but is available in some other versions of `3.11.x`
and `3.12.x`; clearly depending on that is not really sane,
so let's just remove the usage--this allows the full test
suite to pass for me locally with `3.11.7`

* I don't think there was any good reason to keep those
`test_main()` style blocks anyway--perhaps you can encourage
developers to use `pytest path/to/test_module.py`, which
will do the same thing (most/all OSS packages would suggest
that at this point I think); if you have folks who were
running the tests with `python path/to/test_module.py` they'd
need to swap to using `pytest` for the incantation, but maybe
that's something you can live with?
  • Loading branch information
tylerjereddy authored Jan 5, 2024
1 parent bbf60d4 commit 790cc69
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 66 deletions.
11 changes: 0 additions & 11 deletions tests/test_dict_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
dir_path = os.path.dirname(os.path.realpath(__file__))+"/"

import unittest
from test import support
import shlex

from opppy.output import *
Expand Down Expand Up @@ -55,13 +54,3 @@ def test_plot_dictionary(self):

# generate a plot given my plotting arguments, dictionary, and data name
ploter.plot_dict(args, [data], ["my_test_dict"])





def test_main():
support.run_unittest(test_dict_plotting)

if __name__ == '__main__':
test_main()
8 changes: 0 additions & 8 deletions tests/test_dump_ploter.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,3 @@ def test_contour_series_plot(self):
print("Is data available", contour_series_ploter.is_data_available(args, series_data))
# generate a plot given my plotting arguments, dictionary, and data name
contour_series_ploter.plot_2d_series(args, series_data)



def test_main():
support.run_unittest(test_opppy_dump_utils)

if __name__ == '__main__':
test_main()
10 changes: 0 additions & 10 deletions tests/test_dump_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

from opppy.dump_utils import *
import unittest
from test import support

class test_opppy_dump_utils(unittest.TestCase):
def test_dump_parser(self):
Expand Down Expand Up @@ -226,12 +225,3 @@ def test_line_series(self):
print(tracer_t, tracer_grid)
tracer_t, tracer_grid = extract_series_line(data,'time',"temperature",['x','y','z'], [5.0, 1.0, 1.2], [5.0, 2.0, 1.75], npts=5 )
print(tracer_t, tracer_grid)




def test_main():
support.run_unittest(test_opppy_dump_utils)

if __name__ == '__main__':
test_main()
10 changes: 0 additions & 10 deletions tests/test_interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import os
import unittest
from test import support
import shlex

class test_interactive_utils(unittest.TestCase):
Expand Down Expand Up @@ -139,12 +138,3 @@ def test_plot_tally(self):
os.system("python my_interactive_parser.py tally plot -pf interactive_tally.p -sk time -sv 5.0 -dn cool_counts -x bins -xlab 'bin [#]' -y even_counts -ylab 'Counts [#]'")
# test scaling and log axis
os.system("python my_interactive_parser.py tally plot -tf "+dir_path+"example_tally*.txt -tf "+dir_path+"example_tally*.txt -sk cycle -dn cool_counts -x bins -xlab 'bin [#]' -y odd_counts -ylab 'Counts [#]' -lx -ly -sx 10 -sx 1e-3 -sy 10 -sy 1e-3 -xl 0.00001 1000 -yl 0.00001 10000")




def test_main():
support.run_unittest(test_interactive_utils)

if __name__ == '__main__':
unittest.main()
8 changes: 0 additions & 8 deletions tests/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
dir_path = os.path.dirname(os.path.realpath(__file__))+"/"

import unittest
from test import support

from opppy.output import *

Expand Down Expand Up @@ -112,10 +111,3 @@ def test_append_output_dictionary(self):
append_output_dictionary(data2, output_files, opppy_parser)

print(data2)


def test_main():
support.run_unittest(test_opppy_outputs)

if __name__ == '__main__':
test_main()
8 changes: 0 additions & 8 deletions tests/test_tally.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
dir_path = os.path.dirname(os.path.realpath(__file__))+"/"

import unittest
from test import support

from opppy.output import *
from opppy.tally import *
Expand Down Expand Up @@ -87,10 +86,3 @@ def test_append_tally_dictionary(self):
append_tally_dictionary(data2, tally_files, opppy_parser)

print(data2)


def test_main():
support.run_unittest(test_opppy_tally)

if __name__ == '__main__':
test_main()
11 changes: 0 additions & 11 deletions tests/test_tally_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
dir_path = os.path.dirname(os.path.realpath(__file__))+"/"

import unittest
from test import support
import shlex

from opppy.tally import *
Expand Down Expand Up @@ -60,13 +59,3 @@ def test_plot_tally(self):

# generate a plot given my plotting arguments, dictionary, and data name
ploter.plot_dict(args, [data['tally_cycle_data'][index],data['tally_cycle_data'][index+1]], ["my_test_dict t ="+str(data['time'][index]), "my_test_dict t ="+str(data['time'][index+1])])





def test_main():
support.run_unittest(test_dict_plotting)

if __name__ == '__main__':
test_main()

0 comments on commit 790cc69

Please sign in to comment.