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( @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"], ["NB_USER=testuser", "CHOWN_HOME=1"],
["start-notebook.py", "--ServerApp.base_url=/test"], ["start-notebook.py", "--ServerApp.base_url=/test"],
None,
), ),
( (
["NB_USER=testuser", "CHOWN_HOME=1", "JUPYTER_PORT=8123"], ["NB_USER=testuser", "CHOWN_HOME=1", "JUPYTER_PORT=8123"],
["start-notebook.py", "--ServerApp.base_url=/test"], ["start-notebook.py", "--ServerApp.base_url=/test"],
None,
), ),
], ],
) )
@@ -147,13 +145,11 @@ def test_not_healthy(
container: TrackedContainer, container: TrackedContainer,
env: Optional[list[str]], env: Optional[list[str]],
cmd: Optional[list[str]], cmd: Optional[list[str]],
user: Optional[str],
) -> None: ) -> None:
running_container = container.run_detached( running_container = container.run_detached(
tty=True, tty=True,
environment=env, environment=env,
command=cmd, command=cmd,
user=user,
) )
# sleeping some time to let the server start # sleeping some time to let the server start
@@ -164,6 +160,6 @@ def test_not_healthy(
time.sleep(wait_time) time.sleep(wait_time)
time_spent += wait_time time_spent += wait_time
if get_health(running_container) == "healthy": 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" assert get_health(running_container) != "healthy"

View File

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