AoC 2020: day6, benchmark

Signed-off-by: Ettore Dreucci <ettore.dreucci@gmail.com>
This commit is contained in:
2020-12-07 00:29:29 +01:00
parent bbdeed8e8d
commit d99a941116
3 changed files with 7 additions and 2 deletions

View File

@@ -26,7 +26,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip 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 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8 - name: Lint with flake8
run: | run: |

1
.gitignore vendored
View File

@@ -17,6 +17,7 @@ __pycache__
# Pytest # Pytest
.pytest_cache .pytest_cache
.benchmarks
#VSCode #VSCode
.vscode .vscode

View File

@@ -49,12 +49,16 @@ def part2(entries: list) -> int:
count += 1 count += 1
return count return count
def test(): def test_input():
"""pytest testing function""" """pytest testing function"""
entries = extract(TEST_INPUT) entries = extract(TEST_INPUT)
assert part1(entries) == 11 assert part1(entries) == 11
assert part2(entries) == 6 assert part2(entries) == 6
def test_bench(benchmark):
"""pytest-benchmark function"""
benchmark(main)
def main(): def main():
"""main function""" """main function"""
input_path = str(pathlib.Path(__file__).resolve().parent.parent) + "/inputs/" + str(pathlib.Path(__file__).stem) input_path = str(pathlib.Path(__file__).resolve().parent.parent) + "/inputs/" + str(pathlib.Path(__file__).stem)