-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Hatchling dev-mode and editable installations (#308)
* fix(hatchling): filter project-specific bricks when in editable mode and with dev-mode-dirs enabled * bump Hatch hook to 1.3.1
- Loading branch information
1 parent
467cb32
commit 5c3d8ca
Showing
3 changed files
with
72 additions
and
4 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
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,41 @@ | ||
import tomlkit | ||
from polylith.hatch.hooks.bricks import filtered_bricks | ||
|
||
project_toml = """\ | ||
[tool.polylith.bricks] | ||
"../../bases/unittest/one" = "unittest/one" | ||
"../../components/unittest/two" = "unittest/two" | ||
""" | ||
|
||
project_toml_dev_mode = """\ | ||
[tool.hatch.build] | ||
dev-mode-dirs = ["../../components", "../../bases"] | ||
[tool.polylith.bricks] | ||
"../../bases/unittest/one" = "unittest/one" | ||
"../../components/unittest/two" = "unittest/two" | ||
""" | ||
|
||
|
||
def test_filtered_bricks(): | ||
data = tomlkit.loads(project_toml) | ||
|
||
expected = data["tool"]["polylith"]["bricks"] | ||
|
||
first = filtered_bricks(data, version="standard") | ||
second = filtered_bricks(data, version="editable") | ||
|
||
assert first == expected | ||
assert second == expected | ||
|
||
|
||
def test_filtered_bricks_in_project_with_dev_mode_dirs(): | ||
data = tomlkit.loads(project_toml_dev_mode) | ||
|
||
expected = data["tool"]["polylith"]["bricks"] | ||
|
||
first = filtered_bricks(data, version="standard") | ||
second = filtered_bricks(data, version="editable") | ||
|
||
assert first == expected | ||
assert second == {} |