Skip to content

Commit

Permalink
augment Appenv class constructor call with os.getcwd() in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elikoga committed Jun 3, 2024
1 parent a81d6df commit 86ffd9c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def test_init(workdir, monkeypatch):

assert not os.path.exists(os.path.join(workdir, "ducker"))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())
env.init()

assert os.readlink(os.path.join(workdir, "ducker", "ducker")) == 'appenv'
Expand Down Expand Up @@ -46,7 +46,7 @@ def test_init(workdir, monkeypatch):
def test_init_explicit_target(workdir, monkeypatch):
monkeypatch.setattr("sys.stdin", io.StringIO("ducker\n\nbaz\n"))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())
env.init()

assert os.path.exists(os.path.join(workdir, "baz"))
Expand All @@ -65,7 +65,7 @@ def test_init_explicit_target(workdir, monkeypatch):
def test_init_explicit_package_and_target(workdir, monkeypatch):
monkeypatch.setattr("sys.stdin", io.StringIO("foo\nbar\nbaz\n"))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())
env.init()

assert os.path.exists(os.path.join(workdir, "baz"))
Expand Down
4 changes: 2 additions & 2 deletions tests/test_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def test_prepare_creates_envdir(workdir, monkeypatch):
monkeypatch.setattr('sys.stdin', io.StringIO('ducker\nducker<2.0.2\n\n'))
os.makedirs(os.path.join(workdir, 'ducker'))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())
env.init()
assert not os.path.exists(env.appenv_dir)
env.update_lockfile()
Expand All @@ -20,7 +20,7 @@ def test_prepare_creates_venv_symlink(workdir, monkeypatch):
monkeypatch.setattr('sys.stdin', io.StringIO('ducker\nducker<2.0.2\n\n'))
os.makedirs(os.path.join(workdir, 'ducker'))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())
env.init()
env.update_lockfile()
env.prepare()
Expand Down
8 changes: 4 additions & 4 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_bootstrap_lockfile_missing_dependency():
def test_bootstrap_and_run_with_lockfile(workdir, monkeypatch):
monkeypatch.setattr("sys.stdin", io.StringIO("ducker\nducker==2.0.1\n\n"))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())

env.init()
env.update_lockfile()
Expand All @@ -37,7 +37,7 @@ def test_bootstrap_and_run_with_lockfile(workdir, monkeypatch):
def test_bootstrap_and_run_python_with_lockfile(workdir, monkeypatch):
monkeypatch.setattr("sys.stdin", io.StringIO("ducker\nducker==2.0.1\n\n"))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())

env.init()
env.update_lockfile()
Expand All @@ -57,7 +57,7 @@ def test_bootstrap_and_run_without_lockfile(workdir, monkeypatch):
"""It raises as error if no requirements.lock is present."""
monkeypatch.setattr("sys.stdin", io.StringIO("ducker\nducker==2.0.1\n\n"))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())

env.init()

Expand All @@ -78,7 +78,7 @@ def test_bootstrap_and_run_without_lockfile(workdir, monkeypatch):
def test_bootstrap_and_run_with_outdated_lockfile(workdir, monkeypatch):
monkeypatch.setattr("sys.stdin", io.StringIO("ducker\nducker==2.0.1\n\n"))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())

env.init()
env.update_lockfile()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_update_lockfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def test_init_and_create_lockfile(workdir, monkeypatch):
monkeypatch.setattr('sys.stdin', io.StringIO('ducker\nducker<2.0.2\n\n'))

env = appenv.AppEnv(os.path.join(workdir, 'ducker'))
env = appenv.AppEnv(os.path.join(workdir, 'ducker'), os.getcwd())
env.init()

lockfile = os.path.join(workdir, "ducker", "requirements.lock")
Expand Down

0 comments on commit 86ffd9c

Please sign in to comment.