Remove test dependency on pg_config (#9853)

By mocking the metadata of `psycopg-c`, we avoid a test dependency on
`pg_config` for the warehouse ecosystem test.
This commit is contained in:
konsti 2024-12-13 12:45:08 +01:00 committed by GitHub
parent f80ddf10b6
commit 6051a26995
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 6 deletions

View file

@ -56,12 +56,6 @@ fn transformers() -> Result<()> {
// Source: https://github.com/konstin/warehouse/blob/baae127d90417104c8dee3fdd3855e2ba17aa428/pyproject.toml // Source: https://github.com/konstin/warehouse/blob/baae127d90417104c8dee3fdd3855e2ba17aa428/pyproject.toml
#[test] #[test]
fn warehouse() -> Result<()> { fn warehouse() -> Result<()> {
// This build requires running `pg_config`. We could
// probably stub it out, but for now, we just skip the
// test if we can't run `pg_config`.
if std::process::Command::new("pg_config").output().is_err() {
return Ok(());
}
// Also, takes too long on non-Linux in CI. // Also, takes too long on non-Linux in CI.
if !cfg!(target_os = "linux") && std::env::var_os(EnvVars::CI).is_some() { if !cfg!(target_os = "linux") && std::env::var_os(EnvVars::CI).is_some() {
return Ok(()); return Ok(());

View file

@ -8,6 +8,12 @@ requires-python = "==3.11.*"
[options] [options]
exclude-newer = "2024-08-08T00:00:00Z" exclude-newer = "2024-08-08T00:00:00Z"
[manifest]
[[manifest.dependency-metadata]]
name = "psycopg-c"
version = "3.2.1"
[[package]] [[package]]
name = "alabaster" name = "alabaster"
version = "1.0.0" version = "1.0.0"

View file

@ -153,6 +153,12 @@ dev-dependencies = [
requires = ["hatchling"] requires = ["hatchling"]
build-backend = "hatchling.build" build-backend = "hatchling.build"
# Avoid a dependency on `pg_config`
[[tool.uv.dependency-metadata]]
name = "psycopg-c"
version = "3.2.1"
requires-dist = []
[tool.coverage.run] [tool.coverage.run]
branch = true branch = true
dynamic_context = "test_function" dynamic_context = "test_function"