@@ -17,48 +17,64 @@ articulated in the [Python Community Code of Conduct](https://www.python.org/psf
1717
1818### Setup
1919
20- Run the following:
20+ #### (1) Clone the mypy repository and enter into it
2121```
22- # Clone the mypy repository
2322git clone https://github.com/python/mypy.git
24-
25- # Enter the repository
2623cd mypy
24+ ```
2725
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
2930python3 -m venv venv
3031source venv/bin/activate
32+ ```
3133
32- # Install the test requirements and the project
34+ #### (3) Install the test requirements and the project
35+ ```
3336python3 -m pip install -r test-requirements.txt
3437python3 -m pip install -e .
35- hash -r
38+ hash -r # This resets shell PATH cache, not necessary on Windows
3639```
3740
3841### Running tests
3942
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.
4447
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:
4650```
47- python3 runtests.py self
48- # or equivalently:
49- python3 -m mypy --config-file mypy_self_check.ini -p mypy
51+ python3 runtests.py
5052```
5153
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) :
5355```
5456tox -e py
5557```
5658
57- The easiest way to run a single test is :
59+ Some useful commands for running specific tests include :
5860```
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
5967pytest -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
6074```
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 ) .
6278
6379## First time contributors
6480
0 commit comments