Skip to content

Commit 83007b9

Browse files
authored
Add option to run tests for external libraries (#52)
* add option to run tests for external libraries * black
1 parent bfa476a commit 83007b9

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
run: |
7070
eval $(opam env)
7171
cd coqpyt
72-
pytest tests -s
72+
pytest tests -s --runextra
7373
7474
- name: Save opam
7575
id: cache-opam-save

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,17 @@ with ProofFile(os.path.join(os.getcwd(), "examples/readme.v")) as proof_file:
189189

190190
## Tests
191191

192-
To run the tests for CoqPyt go to the folder ``coqpyt`` and run:
192+
To run the core tests for CoqPyt go to the folder ``coqpyt`` and run:
193193
```bash
194-
pytest tests -s
194+
pytest tests -rs
195+
```
196+
197+
Skipped tests require the following external Coq libraries to run successfully:
198+
- [Coq-Equations](https://github.com/mattam82/Coq-Equations)
199+
200+
To run all tests go to the folder ``coqpyt`` and run:
201+
```bash
202+
pytest tests -rs --runextra
195203
```
196204

197205
## Contributing

coqpyt/tests/conftest.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import pytest
2+
3+
4+
def pytest_addoption(parser):
5+
parser.addoption(
6+
"--runextra",
7+
action="store_true",
8+
default=False,
9+
help="run extra tests from external libraries",
10+
)
11+
12+
13+
def pytest_configure(config):
14+
config.addinivalue_line("markers", "extra: mark test as from external library")
15+
16+
17+
def pytest_collection_modifyitems(config, items):
18+
if config.getoption("--runextra"):
19+
return
20+
skip_extra = pytest.mark.skip(reason="need --runextra option to run")
21+
for item in items:
22+
if "extra" in item.keywords:
23+
item.add_marker(skip_extra)

coqpyt/tests/test_coq_file.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,9 @@ def test_derive(setup, teardown):
280280
)
281281

282282

283+
@pytest.mark.extra
283284
@pytest.mark.parametrize("setup", ["test_equations.v"], indirect=True)
284-
def test_derive(setup, teardown):
285+
def test_equations(setup, teardown):
285286
coq_file.run()
286287
assert len(coq_file.context.terms) == 0
287288
assert coq_file.context.last_term is not None

0 commit comments

Comments
 (0)