Skip to content

Commit 4eee867

Browse files
Remove pytest dep (#338)
pytest is nice, but we've written all of our unittests so far with the builtin unittest module. By doing a bit of test rearranging (using test/ as the directory and naming our test files `test_*.py`), we can use the builtin runner and remove pytest from our deps.
1 parent 707fd15 commit 4eee867

13 files changed

+10
-75
lines changed

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ BIN := .tmp/bin
1010
export PATH := $(BIN):$(PATH)
1111
export GOBIN := $(abspath $(BIN))
1212
export PYTHONPATH ?= gen
13-
CONFORMANCE_ARGS ?= --strict_message --expected_failures=tests/conformance/nonconforming.yaml --timeout 10s
13+
CONFORMANCE_ARGS ?= --strict_message --expected_failures=test/conformance/nonconforming.yaml --timeout 10s
1414
ADD_LICENSE_HEADER := $(BIN)/license-header \
1515
--license-type apache \
1616
--copyright-holder "Buf Technologies, Inc." \
@@ -20,7 +20,7 @@ PROTOVALIDATE_VERSION ?= v0.14.0
2020
# Version of the cel-spec that this implementation is conformant with
2121
# This should be kept in sync with the version in format_test.py
2222
CEL_SPEC_VERSION ?= v0.24.0
23-
TESTDATA_FILE := tests/testdata/string_ext_$(CEL_SPEC_VERSION).textproto
23+
TESTDATA_FILE := test/testdata/string_ext_$(CEL_SPEC_VERSION).textproto
2424

2525
.PHONY: help
2626
help: ## Describe useful make targets
@@ -46,22 +46,22 @@ generate: $(BIN)/buf $(BIN)/license-header ## Regenerate code and license header
4646
.PHONY: format
4747
format: install $(BIN)/license-header ## Format code
4848
$(ADD_LICENSE_HEADER)
49-
uv run -- ruff format protovalidate tests
50-
uv run -- ruff check --fix protovalidate tests
49+
uv run -- ruff format protovalidate test
50+
uv run -- ruff check --fix protovalidate test
5151

5252
.PHONY: test
5353
test: generate install gettestdata ## Run unit tests
54-
uv run -- pytest
54+
uv run -- python -m unittest
5555

5656
.PHONY: conformance
5757
conformance: $(BIN)/protovalidate-conformance generate install ## Run conformance tests
58-
protovalidate-conformance $(CONFORMANCE_ARGS) uv -- run python3 -m tests.conformance.runner
58+
protovalidate-conformance $(CONFORMANCE_ARGS) uv -- run python3 -m test.conformance.runner
5959

6060
.PHONY: lint
6161
lint: install ## Lint code
62-
uv run -- ruff format --check --diff protovalidate tests
62+
uv run -- ruff format --check --diff protovalidate test
6363
uv run -- mypy protovalidate
64-
uv run -- ruff check protovalidate tests
64+
uv run -- ruff check protovalidate test
6565
uv sync --locked
6666

6767
.PHONY: install

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Issues = "https://github.com/bufbuild/protovalidate-python/issues"
3232

3333
[dependency-groups]
3434
dev = [
35-
"pytest",
3635
"mypy",
3736
"ruff",
3837
"types-protobuf==6.30.2.20250503",
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/format_test.py renamed to test/test_format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ class TestFormat(unittest.TestCase):
8686
@classmethod
8787
def setUpClass(cls):
8888
# The test data from the cel-spec conformance tests
89-
cel_test_data = load_test_data(f"tests/testdata/string_ext_{CEL_SPEC_VERSION}.textproto")
89+
cel_test_data = load_test_data(f"test/testdata/string_ext_{CEL_SPEC_VERSION}.textproto")
9090
# Our supplemental tests of functionality not in the cel conformance file, but defined in the spec.
91-
supplemental_test_data = load_test_data("tests/testdata/string_ext_supplemental.textproto")
91+
supplemental_test_data = load_test_data("test/testdata/string_ext_supplemental.textproto")
9292

9393
# Combine the test data from both files into one
9494
sections = cel_test_data.section
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)