@@ -62,18 +62,6 @@ like this:
62
62
python3 runtests.py
63
63
```
64
64
65
- You can also use ` tox ` to run tests (` tox ` handles setting up the test environment for you):
66
-
67
- ``` bash
68
- tox run -e py
69
-
70
- # Or some specific python version:
71
- tox run -e py39
72
-
73
- # Or some specific command:
74
- tox run -e lint
75
- ```
76
-
77
65
Some useful commands for running specific tests include:
78
66
79
67
``` bash
@@ -95,6 +83,36 @@ python runtests.py lint
95
83
For an in-depth guide on running and writing tests,
96
84
see [ the README in the test-data directory] ( test-data/unit/README.md ) .
97
85
86
+ #### Using ` tox `
87
+
88
+ You can also use [ ` tox ` ] ( https://tox.wiki/en/latest/ ) to run tests and other commands.
89
+ ` tox ` handles setting up test environments for you.
90
+
91
+ ``` bash
92
+ # Run tests
93
+ tox run -e py
94
+
95
+ # Run tests using some specific Python version
96
+ tox run -e py311
97
+
98
+ # Run a specific command
99
+ tox run -e lint
100
+
101
+ # Run a single test from the test suite
102
+ tox run -e py -- -n0 -k ' test_name'
103
+
104
+ # Run all test cases in the "test-data/unit/check-dataclasses.test" file using
105
+ # Python 3.11 specifically
106
+ tox run -e py311 -- mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test
107
+
108
+ # Set up a development environment with all the project libraries and run a command
109
+ tox -e dev -- mypy --verbose test_case.py
110
+ tox -e dev --override testenv:dev.allowlist_externals+=env -- env # inspect the environment
111
+ ```
112
+
113
+ If you don't already have ` tox ` installed, you can use a virtual environment as
114
+ described above to install ` tox ` via ` pip ` (e.g., `` python3 -m pip install tox `` ).
115
+
98
116
## First time contributors
99
117
100
118
If you're looking for things to help with, browse our [ issue tracker] ( https://github.com/python/mypy/issues ) !
0 commit comments