internal/rosa/python: run tests via helper
All checks were successful
Test / Create distribution (push) Successful in 1m6s
Test / Sandbox (push) Successful in 2m52s
Test / ShareFS (push) Successful in 3m58s
Test / Sandbox (race detector) (push) Successful in 5m22s
Test / Hakurei (race detector) (push) Successful in 6m24s
Test / Hakurei (push) Successful in 2m39s
Test / Flake checks (push) Successful in 1m25s
All checks were successful
Test / Create distribution (push) Successful in 1m6s
Test / Sandbox (push) Successful in 2m52s
Test / ShareFS (push) Successful in 3m58s
Test / Sandbox (race detector) (push) Successful in 5m22s
Test / Hakurei (race detector) (push) Successful in 6m24s
Test / Hakurei (push) Successful in 2m39s
Test / Flake checks (push) Successful in 1m25s
Despite the lack of standards, pytest seems somewhat widely agreed upon. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -22,7 +22,7 @@ func (t Toolchain) newMeson() (pkg.Artifact, string) {
|
|||||||
},
|
},
|
||||||
}, &PipHelper{
|
}, &PipHelper{
|
||||||
EnterSource: true,
|
EnterSource: true,
|
||||||
Script: `
|
Check: `
|
||||||
cd 'test cases'
|
cd 'test cases'
|
||||||
rm -rf \
|
rm -rf \
|
||||||
'common/32 has header' \
|
'common/32 has header' \
|
||||||
|
|||||||
@@ -117,14 +117,23 @@ type PipHelper struct {
|
|||||||
EnterSource bool
|
EnterSource bool
|
||||||
// Whether to install to build environment after install.
|
// Whether to install to build environment after install.
|
||||||
Install bool
|
Install bool
|
||||||
|
// Whether to skip running tests.
|
||||||
|
SkipCheck bool
|
||||||
|
// Replaces pytest if non-empty.
|
||||||
|
Check string
|
||||||
// Runs after install.
|
// Runs after install.
|
||||||
Script string
|
Script string
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ Helper = new(PipHelper)
|
var _ Helper = new(PipHelper)
|
||||||
|
|
||||||
// extra returns python.
|
// extra returns python, or pytest if defaults are assumed.
|
||||||
func (*PipHelper) extra(int) P { return P{Python} }
|
func (attr *PipHelper) extra(int) P {
|
||||||
|
if attr == nil || (!attr.SkipCheck && attr.Check == "") {
|
||||||
|
return P{PythonPyTest}
|
||||||
|
}
|
||||||
|
return P{Python}
|
||||||
|
}
|
||||||
|
|
||||||
// wantsChmod returns true.
|
// wantsChmod returns true.
|
||||||
func (*PipHelper) wantsChmod() bool { return true }
|
func (*PipHelper) wantsChmod() bool { return true }
|
||||||
@@ -154,18 +163,27 @@ func (attr *PipHelper) script(name string) string {
|
|||||||
--no-build-isolation \`
|
--no-build-isolation \`
|
||||||
}
|
}
|
||||||
|
|
||||||
script := attr.Script
|
var script string
|
||||||
if attr.Install {
|
if attr.Install {
|
||||||
script = `pip3 install \
|
script += `pip3 install \
|
||||||
--no-index \
|
--no-index \
|
||||||
--prefix=/system \
|
--prefix=/system \
|
||||||
--no-build-isolation \
|
--no-build-isolation \
|
||||||
'` + sourcePath.String() + `'
|
'` + sourcePath.String() + `'
|
||||||
` + script
|
`
|
||||||
}
|
}
|
||||||
if attr.EnterSource {
|
if attr.EnterSource {
|
||||||
script = "cd '/usr/src/" + name + "'\n" + script
|
script += "cd '/usr/src/" + name + "'\n"
|
||||||
}
|
}
|
||||||
|
if !attr.SkipCheck {
|
||||||
|
if attr.Check == "" {
|
||||||
|
// some test suites fall apart when ran out-of-tree
|
||||||
|
script += "(cd '" + sourcePath.String() + "' && pytest)\n"
|
||||||
|
} else {
|
||||||
|
script += attr.Check
|
||||||
|
}
|
||||||
|
}
|
||||||
|
script += attr.Script
|
||||||
|
|
||||||
return `
|
return `
|
||||||
pip3 install \
|
pip3 install \
|
||||||
@@ -263,7 +281,10 @@ func init() {
|
|||||||
"pypa/setuptools",
|
"pypa/setuptools",
|
||||||
"v"+version, checksum,
|
"v"+version, checksum,
|
||||||
), nil, &PipHelper{
|
), nil, &PipHelper{
|
||||||
|
// error: invalid command 'dist_info'
|
||||||
BuildIsolation: true,
|
BuildIsolation: true,
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
}, nil)
|
}, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,7 +305,10 @@ func init() {
|
|||||||
"SETUPTOOLS_SCM_PRETEND_VERSION=" + version,
|
"SETUPTOOLS_SCM_PRETEND_VERSION=" + version,
|
||||||
},
|
},
|
||||||
}, &PipHelper{
|
}, &PipHelper{
|
||||||
|
// upstream is monorepo of two packages (setuptools-scm)
|
||||||
Append: []string{"vcs-versioning"},
|
Append: []string{"vcs-versioning"},
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
}, nil,
|
}, nil,
|
||||||
PythonSetuptools,
|
PythonSetuptools,
|
||||||
PythonPackaging,
|
PythonPackaging,
|
||||||
@@ -308,7 +332,10 @@ func init() {
|
|||||||
"SETUPTOOLS_SCM_PRETEND_VERSION=" + version,
|
"SETUPTOOLS_SCM_PRETEND_VERSION=" + version,
|
||||||
},
|
},
|
||||||
}, &PipHelper{
|
}, &PipHelper{
|
||||||
|
// upstream is monorepo of two packages
|
||||||
Append: []string{"setuptools-scm"},
|
Append: []string{"setuptools-scm"},
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
}, nil,
|
}, nil,
|
||||||
PythonSetuptools,
|
PythonSetuptools,
|
||||||
PythonVCSVersioning,
|
PythonVCSVersioning,
|
||||||
@@ -328,7 +355,10 @@ func init() {
|
|||||||
"pypa/flit",
|
"pypa/flit",
|
||||||
version, checksum,
|
version, checksum,
|
||||||
), nil, &PipHelper{
|
), nil, &PipHelper{
|
||||||
|
// upstream has other unused packages with many dependencies
|
||||||
Append: []string{"flit_core"},
|
Append: []string{"flit_core"},
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
}, nil,
|
}, nil,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -345,7 +375,10 @@ func init() {
|
|||||||
version, newFromGitHub(
|
version, newFromGitHub(
|
||||||
"pypa/packaging",
|
"pypa/packaging",
|
||||||
version, checksum,
|
version, checksum,
|
||||||
), nil, nil, P{PythonFlitCore},
|
), nil, &PipHelper{
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
|
}, P{PythonFlitCore},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +394,10 @@ func init() {
|
|||||||
version, newFromGitHub(
|
version, newFromGitHub(
|
||||||
"cpburnz/python-pathspec",
|
"cpburnz/python-pathspec",
|
||||||
"v"+version, checksum,
|
"v"+version, checksum,
|
||||||
), nil, nil, P{PythonFlitCore},
|
), nil, &PipHelper{
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
|
}, P{PythonFlitCore},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +413,10 @@ func init() {
|
|||||||
version, newFromGitHub(
|
version, newFromGitHub(
|
||||||
"pypa/trove-classifiers",
|
"pypa/trove-classifiers",
|
||||||
version, checksum,
|
version, checksum,
|
||||||
), nil, nil, P{PythonSetuptools},
|
), nil, &PipHelper{
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
|
}, P{PythonSetuptools},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +436,10 @@ func init() {
|
|||||||
Env: []string{
|
Env: []string{
|
||||||
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PLUGGY=" + version,
|
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PLUGGY=" + version,
|
||||||
},
|
},
|
||||||
}, nil, P{PythonSetuptoolsSCM},
|
}, &PipHelper{
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
|
}, P{PythonSetuptoolsSCM},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,7 +456,10 @@ func init() {
|
|||||||
"pypa/hatch",
|
"pypa/hatch",
|
||||||
"hatch-v"+version, checksum,
|
"hatch-v"+version, checksum,
|
||||||
), nil, &PipHelper{
|
), nil, &PipHelper{
|
||||||
|
// upstream has other unused packages with many dependencies
|
||||||
Append: []string{"backend"},
|
Append: []string{"backend"},
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
}, nil,
|
}, nil,
|
||||||
PythonPackaging,
|
PythonPackaging,
|
||||||
PythonPathspec,
|
PythonPathspec,
|
||||||
@@ -435,7 +480,10 @@ func init() {
|
|||||||
version, newFromGitHub(
|
version, newFromGitHub(
|
||||||
"pygments/pygments",
|
"pygments/pygments",
|
||||||
version, checksum,
|
version, checksum,
|
||||||
), nil, nil, P{PythonHatchling},
|
), nil, &PipHelper{
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
|
}, P{PythonHatchling},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +503,10 @@ func init() {
|
|||||||
Env: []string{
|
Env: []string{
|
||||||
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_INICONFIG=" + version,
|
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_INICONFIG=" + version,
|
||||||
},
|
},
|
||||||
}, nil, P{PythonSetuptoolsSCM},
|
}, &PipHelper{
|
||||||
|
// pytest circular dependency
|
||||||
|
SkipCheck: true,
|
||||||
|
}, P{PythonSetuptoolsSCM},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,7 +526,10 @@ func init() {
|
|||||||
Env: []string{
|
Env: []string{
|
||||||
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST=" + version,
|
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST=" + version,
|
||||||
},
|
},
|
||||||
}, nil, P{PythonSetuptoolsSCM},
|
}, &PipHelper{
|
||||||
|
// many dependencies
|
||||||
|
SkipCheck: true,
|
||||||
|
}, P{PythonSetuptoolsSCM},
|
||||||
PythonIniConfig,
|
PythonIniConfig,
|
||||||
PythonPackaging,
|
PythonPackaging,
|
||||||
PythonPluggy,
|
PythonPluggy,
|
||||||
@@ -496,13 +550,9 @@ func init() {
|
|||||||
"pallets/markupsafe",
|
"pallets/markupsafe",
|
||||||
version, checksum,
|
version, checksum,
|
||||||
), nil, &PipHelper{
|
), nil, &PipHelper{
|
||||||
EnterSource: true,
|
// ModuleNotFoundError: No module named 'markupsafe'
|
||||||
Install: true,
|
Install: true,
|
||||||
Script: "pytest",
|
}, P{PythonSetuptools},
|
||||||
}, P{
|
|
||||||
PythonSetuptools,
|
|
||||||
PythonPyTest,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user