@@ -17,48 +17,64 @@ articulated in the [Python Community Code of Conduct](https://www.python.org/psf
17
17
18
18
### Setup
19
19
20
- Run the following:
20
+ #### (1) Clone the mypy repository and enter into it
21
21
```
22
- # Clone the mypy repository
23
22
git clone https://github.com/python/mypy.git
24
-
25
- # Enter the repository
26
23
cd mypy
24
+ ```
27
25
28
- # Create then activate a virtual environment
26
+ #### (2) Create then activate a virtual environment
27
+ ```
28
+ # On Windows, the commands may be slightly different. For more details, see
29
+ # https://docs.python.org/3/library/venv.html#creating-virtual-environments
29
30
python3 -m venv venv
30
31
source venv/bin/activate
32
+ ```
31
33
32
- # Install the test requirements and the project
34
+ #### (3) Install the test requirements and the project
35
+ ```
33
36
python3 -m pip install -r test-requirements.txt
34
37
python3 -m pip install -e .
35
- hash -r
38
+ hash -r # This resets shell PATH cache, not necessary on Windows
36
39
```
37
40
38
41
### Running tests
39
42
40
- Once setup, you should be able to run tests:
41
- ```
42
- python3 runtests.py
43
- ```
43
+ Running the full test suite can take a while, and usually isn't necessary when
44
+ preparing a PR. Once you file a PR, the full test suite will run on GitHub.
45
+ You'll then be able to see any test failures, and make any necessary changes to
46
+ your PR.
44
47
45
- To use mypy to check mypy's own code, run:
48
+ However, if you wish to do so, you can run the full test suite
49
+ like this:
46
50
```
47
- python3 runtests.py self
48
- # or equivalently:
49
- python3 -m mypy --config-file mypy_self_check.ini -p mypy
51
+ python3 runtests.py
50
52
```
51
53
52
- You can also use ` tox ` to run tests, for instance :
54
+ You can also use ` tox ` to run tests ( ` tox ` handles setting up the test environment for you) :
53
55
```
54
56
tox -e py
55
57
```
56
58
57
- The easiest way to run a single test is :
59
+ Some useful commands for running specific tests include :
58
60
```
61
+ # Use mypy to check mypy's own code
62
+ python3 runtests.py self
63
+ # or equivalently:
64
+ python3 -m mypy --config-file mypy_self_check.ini -p mypy
65
+
66
+ # Run a single test from the test suite
59
67
pytest -n0 -k 'test_name'
68
+
69
+ # Run all test cases in the "test-data/unit/check-dataclasses.test" file
70
+ pytest mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test
71
+
72
+ # Run the linter
73
+ flake8
60
74
```
61
- There's more useful information on writing and running tests [ here] ( test-data/unit/README.md )
75
+
76
+ For an in-depth guide on running and writing tests,
77
+ see [ the README in the test-data directory] ( test-data/unit/README.md ) .
62
78
63
79
## First time contributors
64
80
0 commit comments