Resolve a few TODOs related to Python 3.6

This commit is contained in:
Paul Romano 2021-07-19 16:14:30 -05:00
parent 95aa079c76
commit 0d83672544
4 changed files with 4 additions and 14 deletions

View file

@ -146,10 +146,6 @@ class DataLibrary(EqualityMixin):
raise ValueError("Either path or OPENMC_CROSS_SECTIONS "
"environmental variable must be set")
# Convert to string to support pathlib
# TODO: Remove when support is Python 3.6+ only
path = str(path)
tree = ET.parse(path)
root = tree.getroot()
if root.find('directory') is not None:

View file

@ -158,11 +158,8 @@ class TransportOperator(ABC):
def __enter__(self):
# Save current directory and move to specific output directory
self._orig_dir = os.getcwd()
if not self.output_dir.exists():
self.output_dir.mkdir() # exist_ok parameter is 3.5+
# In Python 3.6+, chdir accepts a Path directly
os.chdir(str(self.output_dir))
self.output_dir.mkdir(exist_ok=True)
os.chdir(self.output_dir)
return self.initial_condition()

View file

@ -68,8 +68,6 @@ class MGXSTestHarness(PyAPITestHarness):
return outstr
@pytest.mark.xfail(sys.version_info < (3, 6),
reason="Pandas 1.0 API changed and requires Python 3.6+")
def test_mgxs_library_distribcell():
model = pwr_assembly()
harness = MGXSTestHarness('statepoint.10.h5', model)

View file

@ -43,12 +43,11 @@ def materials(tmpdir_factory):
with lib.run_in_memory():
yield [lib.Material(), lib.Material()]
finally:
# Convert to strings as os.remove in py 3.5 doesn't support Paths
for file_path in ("settings.xml", "geometry.xml", "materials.xml",
"summary.h5"):
os.remove(str(tmpdir / file_path))
os.remove(tmpdir / file_path)
orig.chdir()
os.rmdir(str(tmpdir))
os.rmdir(tmpdir)
def proxy_tally_data(tally, fill=None):