mirror of
https://github.com/Noettore/AdventOfCode.git
synced 2025-10-14 19:26:39 +02:00
AoC 2020: day6, benchmark
Signed-off-by: Ettore Dreucci <ettore.dreucci@gmail.com>
This commit is contained in:
2
.github/workflows/python.yml
vendored
2
.github/workflows/python.yml
vendored
@@ -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
1
.gitignore
vendored
@@ -17,6 +17,7 @@ __pycache__
|
|||||||
|
|
||||||
# Pytest
|
# Pytest
|
||||||
.pytest_cache
|
.pytest_cache
|
||||||
|
.benchmarks
|
||||||
|
|
||||||
#VSCode
|
#VSCode
|
||||||
.vscode
|
.vscode
|
||||||
|
@@ -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)
|
||||||
|
Reference in New Issue
Block a user