Skip to content

Commit 28cb5bb

Browse files
updated tests to not destroy og dir
1 parent 8bd1686 commit 28cb5bb

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: tests/test_download.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77

88
CONFIG_DIR = os.path.expanduser('~/.config/yt-fts')
99

10+
11+
@pytest.fixture(scope="session", autouse=True)
12+
def cleanup_after_tests():
13+
yield
14+
if os.path.exists(CONFIG_DIR):
15+
shutil.rmtree(CONFIG_DIR)
16+
if os.path.exists(f"{CONFIG_DIR}_backup"):
17+
shutil.move(f"{CONFIG_DIR}_backup", CONFIG_DIR)
18+
19+
1020
@pytest.fixture
1121
def runner():
1222
return CliRunner()
@@ -105,10 +115,8 @@ def test_playlist_download(runner, capsys):
105115
assert video_count == 21, f"Expected 21 videos, but got {video_count}"
106116
assert subtitle_count >= 20970, f"Expected 20970 subtitles, but got {subtitle_count}"
107117

108-
shutil.rmtree(CONFIG_DIR)
109-
shutil.copytree(src=f"{CONFIG_DIR}_backup", dst=CONFIG_DIR)
118+
110119

111120

112121
if __name__ == "__main__":
113122
pytest.main([__file__])
114-

0 commit comments

Comments
 (0)