-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
--pg-extensions appear not to work with CircleCI.
Locally, the pytest --pg-extension-postgis command works fine, but when running the command via CircleCI config, I get the following error:
../miniconda/envs/test/lib/python3.8/site-packages/sqlalchemy/engine/base.py:1283:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2 object at 0x7f70ac219d00>
cursor = <cursor object at 0x7f7105d5c4f0; closed: -1>
statement = 'BEGIN TRANSACTION; CREATE EXTENSION IF NOT EXISTS "postgis"; COMMIT;'
parameters = {}
context = <sqlalchemy.dialects.postgresql.psycopg2.PGExecutionContext_psycopg2 object at 0x7f7105d01e20>
def do_execute(self, cursor, statement, parameters, context=None):
> cursor.execute(statement, parameters)
E psycopg2.errors.UndefinedFile: could not open extension control file "/home/circleci/miniconda/envs/test/share/extension/postgis.control": No such file or directory
../miniconda/envs/test/lib/python3.8/site-packages/sqlalchemy/engine/default.py:590: UndefinedFile
It seems to be caused by my CircleCI directory path, but I am having troubles looking into this deeper without being able to do it locally (it's on the CircleCI server instead). In other words, why isn't "postgis.control" file in /home/circleci/miniconda/envs/test/share/extension/?
The tests run and pass just fine when I remove the --pg-extensions option. Is the best option just to install the extensions via postgresql_db.install_extension('postgis')?
Here is my CircelCi config.yml:
version: 2.1
orbs:
python: circleci/python@0.2.1
jobs:
build-and-test:
working_directory: ~/db
docker:
- image: circleci/python:3.8.2
- image: circleci/postgres:9.6-postgis-ram
environment:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'password'
POSTGRES_DB: test_db
steps:
- checkout
- run:
name: Install dependencies
command: |
wget https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p "$HOME"/miniconda
source /home/circleci/miniconda/etc/profile.d/conda.sh
conda activate base
conda config --set always_yes yes --set auto_update_conda false
conda update conda
# Create test environment
conda create -n test python=$PYTHON_VERSION
conda activate test
conda config --env --add channels conda-forge
conda install -n test --file requirements/testing.txt
pip install -r requirements/testing_pip.txt
- run:
name: Conda information
command: |
source /home/circleci/miniconda/etc/profile.d/conda.sh
conda activate test
conda info
conda config --show
conda list --show-channel-urls
- run:
name: Run tests
command: |
source /home/circleci/miniconda/etc/profile.d/conda.sh
conda activate test
mkdir test-results
# pytest --pg-extensions=postgis--junitxml=test-results/junit.xml --cov=db --cov-report=xml # doesn't work
pytest --junitxml=test-results/junit.xml --cov=db --cov-report=xml # works
Metadata
Metadata
Assignees
Labels
No labels