Skip to content

Commit

Permalink
refactor(07/2024): add env variables to diff local and prod tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aleattene committed Dec 7, 2024
1 parent 022e5b7 commit a019457
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/aoc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
build:

runs-on: ubuntu-latest
env:
ENVIRONMENT: production

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,4 @@ dmypy.json

# Advent of Code
input.txt
input_demo.txt
results.md
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ packaging==24.1
pluggy==1.5.0
pytest==8.3.3
pytest-cov==5.0.0
python-dotenv==1.0.1
Empty file added year_2024/__init__.py
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions year_2024/day_07_bridge_repair/input_demo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
190: 10 19
3267: 81 40 27
83: 17 5
156: 15 6
7290: 6 8 6 15
161011: 16 10 13
192: 17 8 14
21037: 9 7 18 13
292: 11 6 16 20
1 change: 0 additions & 1 deletion year_2024/day_07_bridge_repair/solution_day_07_2024.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,3 @@ def solve_day_07_2024(filename: str) -> tuple[int, int] | str:
calibration_result_with_concat += calibration_result

return calibration_result, calibration_result_with_concat

15 changes: 11 additions & 4 deletions year_2024/day_07_bridge_repair/test_day_07_2024.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import os
from dotenv import load_dotenv
from .solution_day_07_2024 import solve_day_07_2024

load_dotenv()
environment = os.getenv("ENVIRONMENT")

filename_demo = "input_demo.txt"
filename = "input.txt"
current_dir = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -9,8 +13,11 @@


def test_day_07_2024():
result_demo = solve_day_07_2024(file_path_demo)
assert result_demo == (3749, 11387)
result_one = solve_day_07_2024(file_path)
assert result_one == (7579994664753, 438027111276610)
results_demo = solve_day_07_2024(file_path_demo)
assert results_demo == (3749, 11387)
if environment == "development":
expected_results = (int(os.getenv("SOLUTION_01_DAY_07_2024")),
int(os.getenv("SOLUTION_02_DAY_07_2024")))
results = solve_day_07_2024(file_path)
assert expected_results == results

0 comments on commit a019457

Please sign in to comment.