Skip to content

Commit 9f92d2b

Browse files
Add pytest ini_options. Fix skipped test.
1 parent 7974f90 commit 9f92d2b

File tree

6 files changed

+13
-6
lines changed

6 files changed

+13
-6
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ jobs:
3939
JUDGE0_EXTRA_CE_ENDPOINT: ${{ secrets.JUDGE0_EXTRA_CE_ENDPOINT }}
4040
run: |
4141
source venv/bin/activate
42-
pytest -vv tests/
42+
pytest tests

docs/source/contributors_guide/contributing.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ To run the tests locally, you can use the following command:
8080

8181
.. code-block:: console
8282
83-
$ pytest -svv tests -k '<test_name>'
83+
$ pytest tests -k '<test_name>'
8484
8585
This will enable you to run a single test, without incurring the cost of
8686
running the full test suite. If you want to run the full test suite, you can
8787
use the following command:
8888

8989
.. code-block:: console
9090
91-
$ pytest -svv tests
91+
$ pytest tests
9292
9393
or you can create a draft PR and let the CI pipeline run the tests for you.
9494
The CI pipeline will run the tests on every PR, using a private instance

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,6 @@ extend-ignore = [
7272
]
7373
docstring-convention = "numpy"
7474
max-line-length = 88
75+
76+
[tool.pytest.ini_options]
77+
addopts = "-vv"

src/judge0/api.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,11 @@ def _resolve_client(
6767
if isinstance(client, Flavor):
6868
return get_client(client)
6969

70-
if client is None and isinstance(submissions, Iterable) and len(submissions) == 0:
71-
raise ValueError("Client cannot be determined from empty submissions.")
70+
if client is None:
71+
if (
72+
isinstance(submissions, Iterable) and len(submissions) == 0
73+
) or submissions is None:
74+
raise ValueError("Client cannot be determined from empty submissions.")
7275

7376
# client is None and we have to determine a flavor of the client from the
7477
# the submission's languages.

src/judge0/base_types.py

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
class TestCase:
1717
"""Test case data model."""
1818

19+
__test__ = False # Needed to avoid pytest warning
20+
1921
input: Optional[str] = None
2022
expected_output: Optional[str] = None
2123

tests/test_api.py

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ def test_resolve_client_with_flavor(
4848
None,
4949
],
5050
)
51-
@pytest.mark.skip
5251
def test_resolve_client_empty_submissions_argument(submissions):
5352
with pytest.raises(ValueError):
5453
_resolve_client(submissions=submissions)

0 commit comments

Comments
 (0)