[JinJa2] Corrected the macro used for comments on the test file. (#3373)

* Corrected the macro for comments on the test file.
* Added current_date (utcnow()) variable available for template macros.
* Removed unnecessary datetime import from macros file.
* Regenerated all practice exercise test files to add timestamp.
* Changed `datetime.now(tz=timezone.utc)` to `datetime.now(tz=timezone.utc).date()`
* Second regeneration to remove `timestamp` and just keep `date` for test files.
[no important files changed]
This commit is contained in:
BethanyG
2023-07-14 15:52:15 -07:00
committed by GitHub
parent c468f7c9fb
commit e7a6b0dc7d
118 changed files with 355 additions and 119 deletions

View File

@@ -17,12 +17,13 @@ import sys
from githelp import Repo
_py = sys.version_info
if _py.major < 3 or (_py.major == 3 and _py.minor < 6):
print("Python version must be at least 3.6")
if _py.major < 3 or (_py.major == 3 and _py.minor < 7):
print("Python version must be at least 3.7")
sys.exit(1)
import argparse
from datetime import datetime
from datetime import timezone
import difflib
import filecmp
import importlib.util
@@ -393,6 +394,7 @@ def generate(
env.filters["zip"] = zip
env.filters["parse_datetime"] = parse_datetime
env.filters["escape_invalid_escapes"] = escape_invalid_escapes
env.globals["current_date"] = datetime.now(tz=timezone.utc).date()
env.tests["error_case"] = error_case
result = True
for exercise in sorted(Path("exercises/practice").glob(exercise_glob)):