Fix some style issues in tests

This commit is contained in:
Ayaz Salikhov
2024-01-16 16:35:14 +04:00
parent 14a29d12d8
commit d3e18d975c
3 changed files with 6 additions and 17 deletions

View File

@@ -128,18 +128,16 @@ def test_healthy_with_proxy(
@pytest.mark.parametrize(
"env,cmd,user",
"env,cmd",
[
(["NB_USER=testuser", "CHOWN_HOME=1"], None, None),
(["NB_USER=testuser", "CHOWN_HOME=1"], None),
(
["NB_USER=testuser", "CHOWN_HOME=1"],
["start-notebook.py", "--ServerApp.base_url=/test"],
None,
),
(
["NB_USER=testuser", "CHOWN_HOME=1", "JUPYTER_PORT=8123"],
["start-notebook.py", "--ServerApp.base_url=/test"],
None,
),
],
)
@@ -147,13 +145,11 @@ def test_not_healthy(
container: TrackedContainer,
env: Optional[list[str]],
cmd: Optional[list[str]],
user: Optional[str],
) -> None:
running_container = container.run_detached(
tty=True,
environment=env,
command=cmd,
user=user,
)
# sleeping some time to let the server start
@@ -164,6 +160,6 @@ def test_not_healthy(
time.sleep(wait_time)
time_spent += wait_time
if get_health(running_container) == "healthy":
raise RuntimeError("Container should not be healthy for these testcases.")
raise RuntimeError("Container should not be healthy for this testcase")
assert get_health(running_container) != "healthy"

View File

@@ -11,15 +11,8 @@ LOGGER = logging.getLogger(__name__)
THIS_DIR = Path(__file__).parent.resolve()
@pytest.mark.parametrize(
"test_file, output_format",
[
("notebook_math", "pdf"),
("notebook_math", "html"),
("notebook_svg", "pdf"),
("notebook_svg", "html"),
],
)
@pytest.mark.parametrize("test_file", ["notebook_math", "notebook_svg"])
@pytest.mark.parametrize("output_format", ["pdf", "html"])
def test_nbconvert(
container: TrackedContainer, test_file: str, output_format: str
) -> None:

View File

@@ -96,7 +96,7 @@ class CondaPackageHelper:
@staticmethod
def _packages_from_json(env_export: str) -> dict[str, set[str]]:
"""Extract packages and versions from the lines returned by the list of specifications"""
# dependencies = filter(lambda x: isinstance(x, str), json.loads(env_export).get("dependencies"))
# dependencies = filter(lambda x: isinstance(x, str), json.loads(env_export).get("dependencies"))
dependencies = json.loads(env_export).get("dependencies")
# Filtering packages installed through pip in this case it's a dict {'pip': ['toree==0.3.0']}
# Since we only manage packages installed through mamba here