Circle CI not running tests

python
circle.yml
ui-test

#1

Hey guys, I just setup Circle CI to my git account. I’ve created a circle.yml but tests aren’t being run. It shows that it runs 0 tests under nosetests – what’s going on here?

I’m using django and my circle.yml looks like this:

machine:
python:
version: 3.4.3

dependencies:
pre:
- pip install -r requirements.txt
test:
override:
- python manage.py test --keepdb


#2

Can you try running these via SSH https://circleci.com/docs/1.0/ssh-build/#nav-button – this should help you see what is happening on the build container.


#3

Cool, I saw the issue. I didn’t have my circle.yml file in the root dir, but one dir above.

I’m trying to use Circle CI 2.0 and I have a docker command I run in my code. It’s a docker call to a public remote image. I’m trying to install docker, but don’t seem able to – I ran through the instructions here: https://circleci.com/docs/2.0/custom-images/

Do I have to push the image to Circle CI’s docker hub? Is there anyway to just install the docker command? I just need to run docker ___________.


#4

Okay I’ve been messing around and I can load an image with a docker container instead.

I’m not sure how to connect to the DB though if I have just a pure docker container.

My config.yml looks like this:

version: 2
jobs:
  build:
    working_directory: ~/tests
    docker:
      - image: docker:17.05.0-ce-git
        environment:
          environment:
          RDS_USERNAME: postgres
          RDS_DB_NAME: circle_test
          RDS_PASSWORD: ""
          RDS_HOSTNAME: 127.0.0.1
          RDS_PORT: ""
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: Install docker-alpine essentials
          command: |
            apk add --update alpine-sdk
            docker run --name tests -d postgres
      - run:
          name: Install python
          command: |
            apk add --no-cache \
              python3 \
              postgresql-dev=9.6.3-r0 \
              libxml2-dev \
              libxslt-dev \
              libjpeg-turbo-dev \
              python3-dev \
              postgresql

      - restore_cache:
          key: deps1-{{ .Branch }}-{{ checksum "tests/requirements.txt" }}
      - run:
          name: Install Python deps in a venv
          command: |
            python3 -m venv venv2
            . venv2/bin/activate
            pip install --upgrade pip
            pip install -r safesign/requirements.txt
      - save_cache:
          key: deps1-{{ .Branch }}-{{ checksum "tests/requirements.txt" }}
          paths:
            - "venv2"
      - run:
          name: 'Pull pdf2html docker image'
          command: 'docker pull bwits/pdf2htmlex'
      - run:
          command: |
            . venv2/bin/activate
            python3 safesign/manage.py test safesign --keep
      - store_artifacts:
          path: test-reports/
          destination: tr1
      - store_test_results:
          path: test-reports/

But it’s missing being able to connect to the postgres db. I know I need to start it up in the docker container somehow and link it but I’m not sure how to do so.

I also don’t think I’m doing this completely the right way (I think I should be setting up my own docker image to run a lot of the “RUN” tasks that I’ve defined in the config.yml), but this is the fastest way I could understand getting it up.


#5

Okay got it running!

for anyone who needs help, here is my final config.yml file (before I optimize things). You just have to tell docker that we have another image.

version: 2
jobs:
  build:
    working_directory: ~/tests
    docker:
      - image: docker:17.05.0-ce-git
        environment:
          environment:
          RDS_USERNAME: postgres
          RDS_DB_NAME: circle_test
          RDS_PASSWORD: ""
          RDS_HOSTNAME: 127.0.0.1
          RDS_PORT: ""
     - image: postgres:9.6.2
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: Install docker-alpine essentials
          command: |
            apk add --update alpine-sdk
      - run:
          name: Install python
          command: |
            apk add --no-cache \
              python3 \
              postgresql-dev=9.6.3-r0 \
              libxml2-dev \
              libxslt-dev \
              libjpeg-turbo-dev \
              python3-dev \
              postgresql
      - restore_cache:
          key: deps1-{{ .Branch }}-{{ checksum "tests/requirements.txt" }}
      - run:
          name: Install Python deps in a venv
          command: |
            python3 -m venv venv2
            . venv2/bin/activate
            pip install --upgrade pip
            pip install -r tests/requirements.txt
      - save_cache:
          key: deps1-{{ .Branch }}-{{ checksum "tests/requirements.txt" }}
          paths:
            - "venv2"
      - run:
          name: 'Pull pdf2html docker image'
          command: 'docker pull bwits/pdf2htmlex'
      - run:
          command: |
            . venv2/bin/activate
            python3 tests/manage.py test tests --keep
      - store_artifacts:
          path: test-reports/
          destination: tr1
      - store_test_results:
          path: test-reports/

#6