Hi,
I'm new to bitbucket pipelines - please excuse any obvious errors.
I have a django app for which I'm trying to get unit tests running.
Here's my bitbucket-pipelines.yaml:
image: python:3.6.5
pipelines:
default:
- step:
script:
- apt-get update && apt-get install -y build-essential libffi-dev libsnappy-dev libssl-dev libxml2-dev libxslt1-dev python3-dev python3-pip
- step:
script:
- pip3 install -r requirements.txt
- step:
script:
- python manage.py test --parallel
services:
- postgres
definitions:
services:
postgres:
image: postgres:10
While going through the installation of python packages via pip, I get the following error when installing the snappy package:
Running setup.py bdist_wheel for python-snappy: finished with status 'error'
Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-trjh_l79/python-snappy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-yo8m3qob --python-tag cp36:
/usr/local/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'cffi_modules'
warnings.warn(msg)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/snappy
copying snappy/hadoop_snappy.py -> build/lib.linux-x86_64-3.6/snappy
copying snappy/snappy_formats.py -> build/lib.linux-x86_64-3.6/snappy
copying snappy/snappy_cffi_builder.py -> build/lib.linux-x86_64-3.6/snappy
copying snappy/__init__.py -> build/lib.linux-x86_64-3.6/snappy
copying snappy/snappy_cffi.py -> build/lib.linux-x86_64-3.6/snappy
copying snappy/__main__.py -> build/lib.linux-x86_64-3.6/snappy
copying snappy/snappy.py -> build/lib.linux-x86_64-3.6/snappy
running build_ext
building 'snappy._snappy' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/snappy
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python3.6m -c snappy/snappymodule.cc -o build/temp.linux-x86_64-3.6/snappy/snappymodule.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
snappy/snappymodule.cc:31:22: fatal error: snappy-c.h: No such file or directory
#include <snappy-c.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
Any advice would be appreciated.
Hi Muhammed,
It appears that in each step you are setting up parts of the environment in order to run your python tests. State however in pipelines does not carry along automatically, each step is a fresh container, you can pass along artifacts between steps but tht would not help in your yaml above.
First can you change your yaml to be as follows (which will setup the state for the container correctly by installing the required packages and python dependencies in the same conatiner the tests are run in).
image: python:3.6.5
pipelines:
default:
- step:
script:
- apt-get update && apt-get install -y build-essential libffi-dev libsnappy-dev libssl-dev libxml2-dev libxslt1-dev python3-dev python3-pip
- pip3 install -r requirements.txt
- python manage.py test --parallel
services:
- postgres
definitions:
services:
postgres:
image: postgres:10
If it still fails with the same error can you test locally the build in a container to ensure that the python image you are using is setup correctly (as the container is a different environment to your development machine).
https://confluence.atlassian.com/bitbucket/debug-your-pipelines-locally-with-docker-838273569.html
Kind Regards,
Nathan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.