Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hauntsaninja committed Jan 10, 2024
1 parent 7232275 commit 5107511
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion piptools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def maybe_statically_parse_project_metadata(
with open(src_file, "rb") as f:
pyproject_contents = tomllib.load(f)
except tomllib.TOMLDecodeError:
pyproject_contents = {}
return None

# Not valid PEP 621 metadata
if (
Expand Down
4 changes: 4 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ def test_static_parse(tmp_path):
assert [str(r.req) for r in metadata.requirements] == ["bar>=1", "qux[extra]"]
assert metadata.extras == ("baz",)

invalid_toml = """this is not valid toml"""
src_file.write_text(invalid_toml)
assert maybe_statically_parse_project_metadata(src_file) is None

no_pep621 = """
[build-system]
requires = ["setuptools"]
Expand Down

0 comments on commit 5107511

Please sign in to comment.