Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mkennard-aquaveo committed Dec 6, 2023
1 parent a21e3a3 commit 6f7aadf
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions _package/tests/unit_tests/filesystem_pyt.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ def test_clear_folder(self):
"""Tests filesystem.clear_folder()."""
# Test using str
d = tempfile.mkdtemp()
temp_file = tempfile.TemporaryFile(mode='w', dir=d)
temp_file = tempfile.NamedTemporaryFile(mode='wt', dir=d)
assert Path(temp_file).is_file()
clear_folder(d)
assert not Path(temp_file).is_file()

# Test using pathlib
temp_file = tempfile.TemporaryFile(mode='w', dir=d)
temp_file = tempfile.NamedTemporaryFile(mode='wt', dir=d)
assert Path(temp_file).is_file()
clear_folder(Path(d))
assert not Path(temp_file).is_file()
Expand All @@ -180,7 +180,7 @@ def test_make_or_clear_dir(self):
assert not Path(path).is_dir()
make_or_clear_dir(path)
assert Path(path).is_dir()
temp_file = tempfile.TemporaryFile(mode='w', dir=path)
temp_file = tempfile.NamedTemporaryFile(mode='wt', dir=path)
assert Path(temp_file).is_file()
make_or_clear_dir(path)
assert not Path(temp_file).is_file()
Expand All @@ -192,7 +192,7 @@ def test_make_or_clear_dir(self):
assert not path.is_dir()
make_or_clear_dir(path)
assert path.is_dir()
temp_file = tempfile.TemporaryFile(mode='w', dir=path)
temp_file = tempfile.NamedTemporaryFile(mode='wt', dir=path)
assert Path(temp_file).is_file()
make_or_clear_dir(path)
assert not Path(temp_file).is_file()
Expand All @@ -218,7 +218,7 @@ def test_copyfile(self):
"""Tests filesystem.copyfile()."""
# Test using str
d = tempfile.mkdtemp()
temp_file = tempfile.TemporaryFile(mode='w', dir=d)
temp_file = tempfile.NamedTemporaryFile(mode='wt', dir=d)
with Path(temp_file).open('w') as file:
file.write('bob')
temp_file_copy = os.path.join(d, 'copy')
Expand All @@ -228,7 +228,7 @@ def test_copyfile(self):

# Test using pathlib
d = tempfile.mkdtemp()
temp_file = tempfile.TemporaryFile(mode='w', dir=d)
temp_file = tempfile.NamedTemporaryFile(mode='wt', dir=d)
with Path(temp_file).open('w') as file:
file.write('bob')
temp_file_copy = os.path.join(d, 'copy')
Expand All @@ -239,20 +239,20 @@ def test_copyfile(self):
def test_removefile(self):
"""Tests filesystem.removefile()."""
# Test using str
temp_file = tempfile.TemporaryFile(mode='w')
temp_file = tempfile.NamedTemporaryFile(mode='wt')
assert Path(temp_file).is_file()
removefile(temp_file)
assert Path(temp_file).is_file()

# Test using pathlib
temp_file = tempfile.TemporaryFile(mode='w')
temp_file = tempfile.NamedTemporaryFile(mode='wt')
assert Path(temp_file).is_file()
removefile(Path(temp_file))
assert Path(temp_file).is_file()

def test_is_somewhere_below_system_temp(self):
"""Tests filesystem.is_somewhere_below_system_temp()."""
temp_file = tempfile.TemporaryFile(mode='w')
temp_file = tempfile.NamedTemporaryFile(mode='wt')
self.assertTrue(True, is_somewhere_below_system_temp(temp_file))
self.assertTrue(True, is_somewhere_below_system_temp(Path(temp_file)))
Path(temp_file).unlink()

0 comments on commit 6f7aadf

Please sign in to comment.