Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Run some Windows environment variable tests only on Windows#1774

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletionstest/test_util.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,7 +46,7 @@ def permission_error_tmpdir(tmp_path):
"""Fixture to test permissions errors in situations where they are not overcome."""
td = tmp_path / "testdir"
td.mkdir()
(td / "x").write_bytes(b"")
(td / "x").touch()

# Set up PermissionError on Windows, where we can't delete read-only files.
(td / "x").chmod(stat.S_IRUSR)
Expand All@@ -73,7 +73,7 @@ def test_deletes_nested_dir_with_files(self, tmp_path):
td / "s" / "y",
td / "s" / "z",
):
f.write_bytes(b"")
f.touch()

try:
rmtree(td)
Expand All@@ -95,7 +95,7 @@ def test_deletes_dir_with_readonly_files(self, tmp_path):
for d in td, td / "sub":
d.mkdir()
for f in td / "x", td / "sub" / "y":
f.write_bytes(b"")
f.touch()
f.chmod(0)

try:
Expand All@@ -115,7 +115,7 @@ def test_avoids_changing_permissions_outside_tree(self, tmp_path):

dir1 = tmp_path / "dir1"
dir1.mkdir()
(dir1 / "file").write_bytes(b"")
(dir1 / "file").touch()
(dir1 / "file").chmod(stat.S_IRUSR)
old_mode = (dir1 / "file").stat().st_mode

Expand DownExpand Up@@ -207,24 +207,28 @@ def _run_parse(name, value):
)
return ast.literal_eval(output)

@pytest.mark.skipif(
os.name != "nt",
reason="These environment variables are only used on Windows.",
)
@pytest.mark.parametrize(
"env_var_value, expected_truth_value",
[
(None,os.name == "nt"), #True on Windows when the environment variable is unset.
(None,True), #When the environment variable is unset.
("", False),
(" ", False),
("0", False),
("1",os.name == "nt"),
("1",True),
("false", False),
("true",os.name == "nt"),
("true",True),
("False", False),
("True",os.name == "nt"),
("True",True),
("no", False),
("yes",os.name == "nt"),
("yes",True),
("NO", False),
("YES",os.name == "nt"),
("YES",True),
(" no ", False),
(" yes ",os.name == "nt"),
(" yes ",True),
],
)
@pytest.mark.parametrize(
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp