Skip to content

Commit

Permalink
fix prefixed slash is relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdallah-Ragab committed Sep 17, 2023
1 parent 5ee63f4 commit 821ee5b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/test_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,29 +160,29 @@ def setUp(self) -> None:
return super().setUp()

def tearDown(self):
recursive_remove_dir('/__tmp__')
recursive_remove_dir('__tmp__')
return super().tearDown()

def test_same_filename(self):
filepath = '/__tmp__/test_file.xyz'
filepath = '__tmp__/test_file.xyz'
new_filename = 'test_file.xyz'
result = rename_file(filepath, new_filename)
self.assertEqual(result, Path(filepath), msg="The rename_file should return the same path to the file when the new filename is the same as the old one.")

def test_file_not_exist(self):
filepath = '/__tmp__/test_file_unique_4312349545.xyz'
filepath = '__tmp__/test_file_unique_4312349545.xyz'
new_filename = 'new_test_file.xyz'
with self.assertRaises(ValueError, msg="Expected ValueError Exception to be raised when file does not exist"):
rename_file(filepath, new_filename)

def test_path_not_file(self):
filepath = '/__tmp__'
filepath = '__tmp__'
new_filename = 'new_test_file.xyz'
with self.assertRaises(ValueError, msg="Expected ValueError Exception to be raised when path is not a file"):
rename_file(filepath, new_filename)

def test_rename_file(self):
filepath = '/__tmp__/test_file.xyz'
filepath = '__tmp__/test_file.xyz'
new_filename = 'new_test_file.xyz'
new_filepath = Path(filepath).parent / new_filename
Path(filepath).touch()
Expand All @@ -191,7 +191,7 @@ def test_rename_file(self):
self.assertTrue(result.exists(), msg="The renamed file should exist.")

def test_failed_rename_file(self):
filepath = '/__tmp__/test_file.xyz'
filepath = '__tmp__/test_file.xyz'
new_filename = 'new_test_file.xyz'
new_filepath = Path(filepath).parent / new_filename
Path(filepath).touch()
Expand Down

0 comments on commit 821ee5b

Please sign in to comment.