Skip to content

Commit

Permalink
tests: use shared test data for ebuild pkg defined_phases tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radhermit committed Dec 20, 2023
1 parent 057d548 commit 506ca66
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion testdata
24 changes: 8 additions & 16 deletions tests/pkg/test_ebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,26 +268,18 @@ def test_src_uri(self, ebuild_repo):
"https://a.com/z -> z.tar.xz",
]

def test_defined_phases(self, ebuild_repo):
def test_defined_phases(self):
# none
pkg = ebuild_repo.create_pkg("cat/pkg-1")
pkg = TEST_DATA.repos["metadata"]["phases/none-0"]
assert pkg.defined_phases == []

# single
data = "src_configure() { :; }"
pkg = ebuild_repo.create_pkg("cat/pkg-1", data=data)
assert pkg.defined_phases == {"src_configure"}
# ebuild-defined
pkg = TEST_DATA.repos["metadata"]["phases/direct-0"]
assert pkg.defined_phases == ["src_compile", "src_install", "src_prepare"]

# multiple
data = textwrap.dedent(
"""
src_prepare() { :; }
src_configure() { :; }
src_compile() { :; }
"""
)
pkg = ebuild_repo.create_pkg("cat/pkg-1", data=data)
assert pkg.defined_phases == {"src_prepare", "src_configure", "src_compile"}
# eclass-defined
pkg = TEST_DATA.repos["metadata"]["phases/indirect-0"]
assert pkg.defined_phases == ["src_install", "src_prepare", "src_test"]

def test_homepage(self, ebuild_repo):
# none
Expand Down

0 comments on commit 506ca66

Please sign in to comment.