Skip to content

Commit 0585bf9

Browse files
committed
Simplify mock and remove print statement
1 parent 9080dd2 commit 0585bf9

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

test/unit/nox/_package_check_test.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import shutil
22
from pathlib import Path
33
from unittest.mock import (
4-
MagicMock,
54
patch,
65
)
76

87
import pytest
98
from nox.command import CommandFailed
109

11-
from exasol.toolbox.config import BaseConfig
1210
from exasol.toolbox.nox._package import (
1311
PROJECT_CONFIG,
1412
package_check,
@@ -39,12 +37,9 @@ def test_raises_non_zero_exist_with_readme_error(nox_session, tmp_path):
3937
package_readme.open(mode="a").write(not_closed_link_error)
4038

4139
# use of the folder with errors in the nox -s package:check function
42-
config = BaseConfig()
43-
mock = MagicMock(spec=BaseConfig, wraps=config)
44-
mock.root = package
4540
with pytest.raises(CommandFailed) as e:
46-
with patch("exasol.toolbox.nox._package.PROJECT_CONFIG", mock):
47-
print(PROJECT_CONFIG.root)
41+
with patch("exasol.toolbox.nox._package.PROJECT_CONFIG") as config:
42+
config.root = package
4843
package_check(nox_session)
4944
# verify broken with non-zero exit status
5045
assert str(e.value) == "Returned code 1"

0 commit comments

Comments
 (0)