Skip to content

Commit 68d8c5a

Browse files
committed
Fix.
1 parent 6163abe commit 68d8c5a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/pytask_environment/logging.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ def pytask_log_session_header(session) -> None:
6060
if session.config["update_environment"] or package is None:
6161
console.print("Updating the information in the database.")
6262
create_or_update_state("python", sys.version, sys.executable)
63-
elif (not same_version and not session.config["check_python_version"]) and (
64-
not same_path and not session.config["check_python_version"]
65-
):
63+
elif not msg:
6664
pass
6765
else:
6866
console.print()

tests/test_logging.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_flow_when_python_version_has_changed(monkeypatch, tmp_path, runner):
6363
assert "Updating the information" in result.output
6464

6565
# Run with a fake version and not updating the environment.
66-
monkeypatch.setattr("pytask_environment.collect.sys.version", fake_version)
66+
monkeypatch.setattr("pytask_environment.logging.sys.version", fake_version)
6767

6868
result = runner.invoke(cli)
6969
assert result.exit_code == 1
@@ -75,8 +75,8 @@ def test_flow_when_python_version_has_changed(monkeypatch, tmp_path, runner):
7575
assert python.path == real_python_executable
7676

7777
# Run with a fake version and updating the environment.
78-
monkeypatch.setattr("pytask_environment.collect.sys.version", fake_version)
79-
monkeypatch.setattr("pytask_environment.collect.sys.executable", "new_path")
78+
monkeypatch.setattr("pytask_environment.logging.sys.version", fake_version)
79+
monkeypatch.setattr("pytask_environment.logging.sys.executable", "new_path")
8080

8181
result = runner.invoke(cli, ["--update-environment"])
8282
assert result.exit_code == 0
@@ -114,7 +114,7 @@ def test_python_version_changed(
114114
assert "Updating the information" in result.output
115115

116116
# Run with a fake version and not updating the environment.
117-
monkeypatch.setattr("pytask_environment.collect.sys.version", fake_version)
117+
monkeypatch.setattr("pytask_environment.logging.sys.version", fake_version)
118118

119119
result = runner.invoke(cli, [tmp_path.as_posix()])
120120
assert result.exit_code == expected
@@ -143,7 +143,7 @@ def test_environment_changed(
143143
assert "Updating the information" in result.output
144144

145145
# Run with a fake version and not updating the environment.
146-
monkeypatch.setattr("pytask_environment.collect.sys.executable", "new_path")
146+
monkeypatch.setattr("pytask_environment.logging.sys.executable", "new_path")
147147

148148
result = runner.invoke(cli, [tmp_path.as_posix()])
149149
assert result.exit_code == expected

0 commit comments

Comments
 (0)