-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
replace tmpdir with tmp_path #2550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -46,9 +46,9 @@ def test_create_github_url(): | |||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| @pytest.mark.vcr() | ||||||||||||||
| def test_download_github_dir(tmpdir, monkeypatch): | ||||||||||||||
| monkeypatch.chdir(tmpdir) | ||||||||||||||
| def test_download_github_dir(tmp_path, monkeypatch): | ||||||||||||||
| monkeypatch.chdir(tmp_path) | ||||||||||||||
| download_github_dir(WEB_APP_URL, False) | ||||||||||||||
| download_dir = tmpdir.listdir()[0] | ||||||||||||||
| download_dir = tmp_path.listdir()[0] | ||||||||||||||
| assert download_dir.isdir() is True | ||||||||||||||
| assert download_dir.join("index.html").isfile() is True | ||||||||||||||
|
Comment on lines
+52
to
54
|
||||||||||||||
| download_dir = tmp_path.listdir()[0] | |
| assert download_dir.isdir() is True | |
| assert download_dir.join("index.html").isfile() is True | |
| download_dir = list(tmp_path.iterdir())[0] | |
| assert download_dir.is_dir() is True | |
| assert (download_dir / "index.html").is_file() is True |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -18,8 +18,8 @@ def test_create_m3u_content(): | |||||
| assert content.split("\n")[1].startswith("#EXTINF:") | ||||||
| assert content.split("\n")[2].endswith(".mp3") | ||||||
|
|
||||||
| def test_create_m3u_file(tmpdir, monkeypatch): | ||||||
| monkeypatch.chdir(tmpdir) | ||||||
| def test_create_m3u_file(tmp_path, monkeypatch): | ||||||
| monkeypatch.chdir(tmp_path) | ||||||
| playlist = Playlist.from_url(PLAYLIST) | ||||||
| create_m3u_file("test.m3u", playlist.songs, "", "mp3") | ||||||
| assert tmpdir.join("test.m3u").isfile() is True | ||||||
| assert tmp_path.join("test.m3u").isfile() is True | ||||||
|
||||||
| assert tmp_path.join("test.m3u").isfile() is True | |
| assert (tmp_path / "test.m3u").is_file() is True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tmp_pathis apathlib.Pathobject and does not have ajoin()method. Use the/operator instead:assert (tmp_path / "archive.txt").is_file() is True. Also note thatpathlib.Pathusesis_file()instead ofisfile().