diff options
| -rw-r--r-- | .github/workflows/main.yml | 25 | ||||
| -rw-r--r-- | README.rst | 11 | ||||
| -rw-r--r-- | setup.py | 3 | ||||
| -rw-r--r-- | tox.ini | 19 | 
4 files changed, 41 insertions, 17 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c9f83e4e..c856523b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,22 +17,35 @@ jobs:      steps:        - uses: actions/checkout@v1        - uses: TrueBrain/actions-flake8@v1.2 -  lint-local: -    # do not use external action when secrets are exposed. +  flake8:      if: github.event_name == 'push'      runs-on: ubuntu-latest      steps:        - uses: actions/checkout@v1        - uses: actions/setup-python@v1 -      - run: pip install flake8 -      - run: flake8 mitmproxy pathod examples test release +      - run: pip install tox +      - run: tox -e flake8 +  filename_matching: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@v1 +      - uses: actions/setup-python@v1 +      - run: pip install tox +      - run: tox -e filename_matching    mypy:      runs-on: ubuntu-latest      steps:        - uses: actions/checkout@v1        - uses: actions/setup-python@v1 -      - run: pip install mypy -      - run: mypy . +      - run: pip install tox +      - run: tox -e mypy +  individual_coverage: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@v1 +      - uses: actions/setup-python@v1 +      - run: pip install tox +      - run: tox -e individual_coverage    test:      strategy:        fail-fast: false @@ -95,12 +95,15 @@ Testing  -------  If you've followed the procedure above, you already have all the development -requirements installed, and you can run the full test suite with tox_: +requirements installed, and you can run the basic test suite with tox_:  .. code-block:: bash -    tox -e py    # runs Python tests -    tox -e lint  # checks code style +    tox -e py37    # runs Python tests +    tox -e flake8  # checks code style style +    tox -e mypy    # checks static types + +Our CI system has additional tox environments that are run on every pull request and branch on GitHub.  For speedier testing, we recommend you run `pytest`_ directly on individual test files or folders: @@ -109,7 +112,7 @@ For speedier testing, we recommend you run `pytest`_ directly on individual test      cd test/mitmproxy/addons      pytest --cov mitmproxy.addons.anticache --cov-report term-missing --looponfail test_anticache.py -Pytest does not check the code style, so you want to run ``tox -e lint`` again before committing. +Pytest does not check the code style, so you want to run ``tox -e flake8`` again before committing.  Please ensure that all patches are accompanied by matching changes in the test  suite. The project tries to maintain 100% test coverage and enforces this strictly for some parts of the codebase. @@ -92,9 +92,7 @@ setup(          ],          'dev': [              "asynctest>=0.12.0", -            "flake8>=3.7.8,<3.8",              "Flask>=1.0,<1.2", -            "mypy>=0.740,<0.741",              "parver>=0.1,<2.0",              "pytest-asyncio>=0.10.0,<0.11",              "pytest-cov>=2.7.1,<3", @@ -103,7 +101,6 @@ setup(              "pytest>=5.1.3,<6",              "requests>=2.9.1,<3",              "tox>=3.5,<3.15", -            "rstcheck>=2.2,<4.0",          ],          'examples': [              "beautifulsoup4>=4.4.1,<4.9" @@ -1,5 +1,5 @@  [tox] -envlist = py35, py36, py37, lint, individual_coverage, wheeltest, docs +envlist = py35, py36, py37, flake8, filename_matching, mypy, individual_coverage, docs  skipsdist = True  toxworkdir={env:TOX_WORK_DIR:.tox} @@ -22,14 +22,25 @@ deps =  commands =    bash -c "mitmdump --version 2>&1 | grep 'mitmproxy requires Python 3.6'" -[testenv:lint] +[testenv:flake8] +deps = flake8>=3.7.8,<3.8  commands = -  mitmdump --version    flake8 --jobs 8 mitmproxy pathod examples test release + +[testenv:filename_matching] +commands =    python ./test/filename_matching.py -  rstcheck README.rst + +[testenv:mypy] +deps = mypy>=0.761,<0.762 +commands =    mypy . +[testenv:rstcheck] +deps = rstcheck>=2.2,<4.0 +commands = +  rstcheck README.rst +  [testenv:individual_coverage]  deps =    -rrequirements.txt  | 
