diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 4753618..baf9beb 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 pytest + python -m pip install flake8 pytest pytest-benchmark if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | diff --git a/.gitignore b/.gitignore index ab9bf49..befb9a8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ __pycache__ # Pytest .pytest_cache +.benchmarks #VSCode .vscode diff --git a/2020-python/solutions/day_6.py b/2020-python/solutions/day_6.py index fde2ab3..7205c97 100644 --- a/2020-python/solutions/day_6.py +++ b/2020-python/solutions/day_6.py @@ -49,12 +49,16 @@ def part2(entries: list) -> int: count += 1 return count -def test(): +def test_input(): """pytest testing function""" entries = extract(TEST_INPUT) assert part1(entries) == 11 assert part2(entries) == 6 +def test_bench(benchmark): + """pytest-benchmark function""" + benchmark(main) + def main(): """main function""" input_path = str(pathlib.Path(__file__).resolve().parent.parent) + "/inputs/" + str(pathlib.Path(__file__).stem)