From: Daniele Varrazzo Date: Sat, 21 Aug 2021 01:14:52 +0000 (+0200) Subject: Run windows tests in a way more similar to the built packages X-Git-Tag: 3.0.dev2~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b7f763cb961b06aad16aeb4ca1dae8035eb1e4e;p=thirdparty%2Fpsycopg.git Run windows tests in a way more similar to the built packages --- diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9aa107db3..274cb95c9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -158,21 +158,15 @@ jobs: run: tox -c psycopg -e ${{ matrix.python }} -- --color yes # Build a wheel package of the C extensions. - # Specify a pg_config explicitly because there are wrong ones along the - # path (https://github.com/actions/virtual-environments/issues/3730). - # - # Don't add the Postgres bindir to the path because that causes problems - # in delocating (https://github.com/pypa/cibuildwheel/issues/766). - # # If the wheel is not delocated, import fails with some dll not found # (but it won't tell which one). - name: Build the C wheel if: ${{ matrix.impl == 'c' }} run: | - $env:PG_CONFIG = "C:\Program Files\PostgreSQL\13\bin\pg_config.exe" + $env:Path = "C:\Program Files\PostgreSQL\13\bin\;$env:Path" python ./psycopg_c/setup.py bdist_wheel pip install delvewheel - &"delvewheel" repair @(Get-ChildItem psycopg_c\dist\*.whl) + &"delvewheel" repair --no-mangle libiconv-2.dll @(Get-ChildItem psycopg_c\dist\*.whl) # tox will only build the package from sdist, not from wheel, so we can't # use it for testing. Just test everything in the global installation. @@ -181,4 +175,6 @@ jobs: run: | pip install ./psycopg/[test] &"pip" install @(Get-ChildItem wheelhouse\*.whl) + # Fix the path for the tests using ctypes + $env:Path = "C:\Program Files\PostgreSQL\13\bin\;$env:Path" pytest --color yes diff --git a/psycopg_c/setup.py b/psycopg_c/setup.py index 6e131db5f..71ea0af47 100644 --- a/psycopg_c/setup.py +++ b/psycopg_c/setup.py @@ -29,9 +29,7 @@ with open("psycopg_c/version.py") as f: def get_config(what: str) -> str: - # Allow to specify PG_CONFIG using an env var - # Changing the path in the cibuildwheel image seems difficult - pg_config = os.environ.get("PG_CONFIG", "pg_config") + pg_config = "pg_config" try: out = sp.run([pg_config, f"--{what}"], stdout=sp.PIPE, check=True) except Exception as e: