I am running into an issue where I have my test passing locally, but when running on CircleCI I am not passing the tests.
The test are failing in a way that would suggest the models are not being properly created using ModelMommy. I have confirmed this, by removing the model mommy definitions, and running my tests locally again to see the same errors that are cropping up on my CircleCI integration.
I am running the same test command locally, as is being run on CircleCI.
Am I missing a setting that lets CircleCI create temporary models?
Thanks for any help.
Stack I’m using:
Python
Django
Model Mommy
Error I’m seeing:
> assert response.status_code == 200 E AssertionError: assert 302 == 200 E + where 302 = <HttpResponseRedirect status_code=302, "text/html; charset=utf-8", url="/">.status_code
Where this works correctly on my machine when testing, and is not a redirect. I can make it a redirect if the model definition using ModelMommy does not exist. This is because one of my views does a redirect to the home page in the event that the model does not exist.
Which troubleshooting steps you’ve already taken:
- Re-run without cache
- Tests passing locally
- Running tests locally without model mommy - causes similar issues, but not convinced that is an exact indicator of why this isn’t working on CircleCI
Current Circle Configuration:
machine: python: version: 3.5.2 node: version: 6.11.1 environment: DATABASE_URL: postgres://ubuntu@127.0.0.1:5432/circle_test SECRET_KEY: Intentionally omitted USE_SECURE_COOKIES: "False" YARN_VERSION: 0.19.1 PATH: ${PATH}:${HOME}/.yarn/bin:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin dependencies: pre: - | if [[ ! -e ~/.yarn/bin/yarn || $(yarn --version) != "${YARN_VERSION}" ]]; then curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION fi cache_directories: - ~/.yarn - ~/.cache/yarn override: - npm install -g bower - yarn install - bower install --config.interactive=false - pip install -r requirements-devel.txt post: - yarn run build-modernizr - yarn run postinstall - python manage.py migrate --noinput test: override: - mkdir -p $CIRCLE_TEST_REPORTS/django - mkdir -p $CIRCLE_TEST_REPORTS/js - PYTHONPATH=$(pwd) ENV_FILE=$(pwd)/.env py.test --junitxml=$CIRCLE_TEST_REPORTS/django/junit.xml - PYTHONPATH=$(pwd) ./manage.py check - ./node_modules/.bin/eslint --format junit static/js > $CIRCLE_TEST_REPORTS/js/junit.xml - ./script/placeholder_tests.bash