Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Created field format in bill of materials #939

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/reuse/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def bill_of_materials(
out.write(f"Creator: Tool: reuse-{__version__}\n")

now = datetime.datetime.now(tz=datetime.timezone.utc)
now = now.replace(microsecond=0)
now = now.replace(microsecond=0, tzinfo=None)
out.write(f"Created: {now.isoformat()}Z\n")
out.write(
"CreatorComment: <text>This document was created automatically"
Expand Down
6 changes: 5 additions & 1 deletion tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


import os
import re
import sys
from importlib import import_module
from textwrap import dedent
Expand Down Expand Up @@ -451,7 +452,10 @@ def test_bill_of_materials(fake_repository, multiprocessing):
project = Project.from_directory(fake_repository)
report = ProjectReport.generate(project, multiprocessing=multiprocessing)
# TODO: Actually do something
report.bill_of_materials()
bom = report.bill_of_materials()
created_re = re.compile(r"^Created: \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$",
re.MULTILINE)
assert created_re.search(bom) is not None


# REUSE-IgnoreEnd
Loading