Files
openfe/openfecli/tests/commands/test_test.py
Alyssa Travitz 036869ae81 Ci/add ruff format part4 - the final format! (#1623)
* format cli tests top level

* format cli commands tests

* format cli parameters tests
2025-10-24 23:50:52 +00:00

29 lines
869 B
Python

import pytest
from unittest import mock
from click.testing import CliRunner
import os
from openfecli.commands.test import test
def mock_func(args):
print(os.environ.get("OFE_SLOW_TESTS"))
@pytest.mark.parametrize("slow", [True, False])
def test_test(slow):
runner = CliRunner()
args = ["--long"] if slow else []
patchloc = "openfecli.commands.test.pytest.main"
ofe_slow_tests = os.environ.get("OFE_SLOW_TESTS")
with mock.patch(patchloc, mock_func):
with runner.isolated_filesystem():
result = runner.invoke(test, args)
assert result.exit_code == 0
l1, l2, l3, _ = result.output.split("\n")
assert l1 == "Testing can import...."
assert l2 == "Running the main package tests"
assert l3 == str(slow)
assert ofe_slow_tests == os.environ.get("OFE_SLOW_TESTS")