-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add description support to `Scenario`s - Add test suite for building and viewing all scenarios in `scenarios/` - Remove duplicate `dist/` directory from `build/<package>/` - Include reason for invalid scenario errors
- Loading branch information
Showing
9 changed files
with
163 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "requires-does-not-exist", | ||
"description": "Package `a` requires any version of package `b` which does not exist", | ||
"root": "a", | ||
"packages": { | ||
"a": { | ||
"versions": { | ||
"1.0.0": { | ||
"requires_python": ">=3.7", | ||
"requires": [ | ||
"b" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# serializer version: 1 | ||
# name: test_build_all_scenarios[requires-does-not-exist] | ||
dict({ | ||
'exit_code': 0, | ||
'filesystem': dict({ | ||
'build/requires-does-not-exist-1888d2a8/requires-does-not-exist-1888d2a8-a-1.0.0/pyproject.toml': ''' | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.hatch.build] | ||
sources = ["src"] | ||
|
||
[project] | ||
name = "requires-does-not-exist-1888d2a8-a" | ||
version = "1.0.0" | ||
dependencies = ["requires-does-not-exist-1888d2a8-b"] | ||
requires-python = ">=3.7" | ||
|
||
''', | ||
'build/requires-does-not-exist-1888d2a8/requires-does-not-exist-1888d2a8-a-1.0.0/src/requires_does_not_exist_1888d2a8_a/__init__.py': ''' | ||
__version__ = "1.0.0" | ||
|
||
''', | ||
'dist/requires-does-not-exist-1888d2a8/requires_does_not_exist_1888d2a8_a-1.0.0-py3-none-any.whl': 'md5:0ede0ef9fce35b3b22369a4091b6d73d', | ||
'dist/requires-does-not-exist-1888d2a8/requires_does_not_exist_1888d2a8_a-1.0.0.tar.gz': 'md5:77825e5070d89109cb92e004c7adf79b', | ||
'tree': ''' | ||
test_build_all_scenarios_requi0 | ||
├── build | ||
│ └── requires-does-not-exist-1888d2a8 | ||
│ └── requires-does-not-exist-1888d2a8-a-1.0.0 | ||
│ ├── pyproject.toml | ||
│ └── src | ||
│ └── requires_does_not_exist_1888d2a8_a | ||
│ └── __init__.py | ||
└── dist | ||
└── requires-does-not-exist-1888d2a8 | ||
├── requires_does_not_exist_1888d2a8_a-1.0.0-py3-none-any.whl | ||
└── requires_does_not_exist_1888d2a8_a-1.0.0.tar.gz | ||
|
||
7 directories, 4 files | ||
|
||
''', | ||
}), | ||
'stderr': ''' | ||
INFO:root:Building 'requires-does-not-exist-1888d2a8' in directory 'build/requires-does-not-exist-1888d2a8' | ||
INFO:packse.template:Creating requires-does-not-exist-1888d2a8-a-1.0.0 | ||
INFO:packse.template:Creating requires-does-not-exist-1888d2a8-a-1.0.0/pyproject.toml | ||
INFO:packse.template:Creating requires-does-not-exist-1888d2a8-a-1.0.0/src | ||
INFO:packse.template:Creating requires-does-not-exist-1888d2a8-a-1.0.0/src/requires_does_not_exist_1888d2a8_a | ||
INFO:packse.template:Creating requires-does-not-exist-1888d2a8-a-1.0.0/src/requires_does_not_exist_1888d2a8_a/__init__.py | ||
INFO:packse.build:Building build/requires-does-not-exist-1888d2a8/requires-does-not-exist-1888d2a8-a-1.0.0 with hatch | ||
INFO:packse.build:Linked distribution to dist/requires-does-not-exist-1888d2a8/requires_does_not_exist_1888d2a8_a-1.0.0.tar.gz | ||
INFO:packse.build:Linked distribution to dist/requires-does-not-exist-1888d2a8/requires_does_not_exist_1888d2a8_a-1.0.0-py3-none-any.whl | ||
|
||
''', | ||
'stdout': ''' | ||
requires-does-not-exist-1888d2a8-a | ||
|
||
''', | ||
}) | ||
# --- | ||
# name: test_view_all_scenarios[requires-does-not-exist] | ||
dict({ | ||
'exit_code': 0, | ||
'filesystem': dict({ | ||
'tree': ''' | ||
test_view_all_scenarios_requir0 | ||
|
||
0 directories | ||
|
||
''', | ||
}), | ||
'stderr': '', | ||
'stdout': ''' | ||
requires-does-not-exist-1888d2a8 | ||
└── a-1.0.0 | ||
└── requires b | ||
|
||
|
||
''', | ||
}) | ||
# --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Tests all included scenarios | ||
""" | ||
|
||
import pytest | ||
from packse import __development_base_path__ | ||
|
||
from .common import snapshot_command | ||
|
||
EXCLUDE = frozenset(("example.json",)) | ||
ALL_SCENARIOS = tuple( | ||
sorted( | ||
path | ||
for path in (__development_base_path__ / "scenarios").iterdir() | ||
if path.is_file() and path.name.endswith(".json") and path.name not in EXCLUDE | ||
) | ||
) | ||
ALL_SCENARIO_IDS = tuple(path.name.removesuffix(".json") for path in ALL_SCENARIOS) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"target", | ||
ALL_SCENARIOS, | ||
ids=ALL_SCENARIO_IDS, | ||
) | ||
@pytest.mark.usefixtures("tmpcwd") | ||
def test_build_all_scenarios(snapshot, target): | ||
assert ( | ||
snapshot_command(["build", str(target)], snapshot_filesystem=True) == snapshot | ||
) | ||
|
||
|
||
@pytest.mark.parametrize("target", ALL_SCENARIOS, ids=ALL_SCENARIO_IDS) | ||
@pytest.mark.usefixtures("tmpcwd") | ||
def test_view_all_scenarios(snapshot, target): | ||
assert snapshot_command(["view", str(target)], snapshot_filesystem=True) == snapshot |