Skip to content

Commit

Permalink
Change tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MasloMaslane committed Oct 5, 2023
1 parent f19102b commit a49b7e1
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,37 +101,6 @@ def test_check_version(**kwargs):
util.check_version()
assert not version_file.is_file()

with tempfile.TemporaryDirectory() as tmpdir:
os.chdir(tmpdir)
with open("config.yml", "w") as config_file:
config_file.write("")

# No permission to write
version_file.write_text("0.0.0")
version_file.chmod(0o000)
mocker.get("https://pypi.python.org/pypi/sinol-make/json", json={"info": {"version": "1.0.0"}})
util.check_version()
assert version_file.is_file()
version_file.chmod(0o777)
assert version_file.read_text() == "0.0.0"
assert os.path.exists(paths.get_cache_path("sinol_make_version"))
with open(paths.get_cache_path("sinol_make_version"), "r") as f:
assert f.read() == "1.0.0"

# No permission to write to cache and data dir
with open(paths.get_cache_path("sinol_make_version"), "w") as f:
f.write("0.0.0")
os.chmod(paths.get_cache_path("sinol_make_version"), 0o000)
os.chmod(paths.get_cache_path(), 0o000)
os.chmod(data_dir, 0o000)
version_file.chmod(0o000)
mocker.get("https://pypi.python.org/pypi/sinol-make/json", json={"info": {"version": "1.0.0"}})
util.check_version()
os.chmod(data_dir, 0o777)
version_file.chmod(0o777)
assert version_file.is_file()
assert version_file.read_text() == "0.0.0"


@pytest.mark.parametrize("create_package", [test_util.get_simple_package_path()], indirect=True)
def test_version_change(create_package):
Expand Down

0 comments on commit a49b7e1

Please sign in to comment.