From 4d247e6f21004d3998bf32d46c22111a380b81af Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Mon, 23 Jan 2023 10:14:58 -0800 Subject: Refactor python rules The goal of this cl is to simplify the python rules, mostly by removing the "decorator" pattern that they currently use, and instead making separate module types for libraries, binaries, and tests that inherit from each other. Bug: 259718110 Test: Verified ninja files are unchanged (they only change in the list of soong sources because I added/deleted files) Change-Id: I1e836e2cc4782c7818f91db7df7895de3b8db7ca --- python/python_test.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'python/python_test.go') diff --git a/python/python_test.go b/python/python_test.go index 42a1ffb2c..6f4223a7c 100644 --- a/python/python_test.go +++ b/python/python_test.go @@ -312,10 +312,6 @@ var ( "e/file4.py", }, srcsZip: "out/soong/.intermediates/dir/bin/PY3/bin.py.srcszip", - depsSrcsZips: []string{ - "out/soong/.intermediates/dir/lib5/PY3/lib5.py.srcszip", - "out/soong/.intermediates/dir/lib6/PY3/lib6.py.srcszip", - }, }, }, }, @@ -346,17 +342,17 @@ func TestPythonModule(t *testing.T) { for _, e := range d.expectedBinaries { t.Run(e.name, func(t *testing.T) { - expectModule(t, result.TestContext, e.name, e.actualVersion, e.srcsZip, e.pyRunfiles, e.depsSrcsZips) + expectModule(t, result.TestContext, e.name, e.actualVersion, e.srcsZip, e.pyRunfiles) }) } }) } } -func expectModule(t *testing.T, ctx *android.TestContext, name, variant, expectedSrcsZip string, expectedPyRunfiles, expectedDepsSrcsZips []string) { +func expectModule(t *testing.T, ctx *android.TestContext, name, variant, expectedSrcsZip string, expectedPyRunfiles []string) { module := ctx.ModuleForTests(name, variant) - base, baseOk := module.Module().(*Module) + base, baseOk := module.Module().(*PythonLibraryModule) if !baseOk { t.Fatalf("%s is not Python module!", name) } @@ -369,8 +365,6 @@ func expectModule(t *testing.T, ctx *android.TestContext, name, variant, expecte android.AssertDeepEquals(t, "pyRunfiles", expectedPyRunfiles, actualPyRunfiles) android.AssertPathRelativeToTopEquals(t, "srcsZip", expectedSrcsZip, base.srcsZip) - - android.AssertPathsRelativeToTopEquals(t, "depsSrcsZips", expectedDepsSrcsZips, base.depsSrcsZips) } func TestMain(m *testing.M) { -- cgit v1.2.3-59-g8ed1b