Skip to content

Commit

Permalink
perf: run pytest in parallel
Browse files Browse the repository at this point in the history
Sample output:

  platform linux -- Python 3.10.9, pytest-7.2.1, pluggy-1.0.0
  rootdir: /home/ilyazub/Workspace/google-search-results-python
  plugins: parallel-0.1.1
  collected 48

  pytest-parallel: 8 workers (processes), 6 tests per worker (threads)

`py` dependency is used because pytest-parallel depends on it but
doesn't require 😕
kevlened/pytest-parallel#118

Co-authored-by: Dimitry <[email protected]>
  • Loading branch information
ilyazub and Dimitry committed Feb 2, 2023
1 parent b0771f4 commit 8aad8da
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,31 @@ clean:
find . -type d -name "__pycache__" -delete
pip3 uninstall google_search_results

create_env:
python -m venv .env
source .env/bin/activate

install:
python3 -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip3 install -r requirements.txt; fi

lint:
lint: build_dep
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

# Test with Python 3
test:
pytest
test: build_dep
pytest --workers auto --tests-per-worker auto

# run example only
# and display output (-s)
example:
pytest -s "tests/test_example.py::TestExample::test_async"

build_dep:
pip3 install -U setuptools pytest flake8
pip3 install -U setuptools pytest py pytest-parallel flake8

# https://packaging.python.org/tutorials/packaging-projects/
build:
Expand Down

0 comments on commit 8aad8da

Please sign in to comment.