# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
  build:
    docker:
      - image: circleci/python:3.6

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "dev-requirements.txt" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install -r requirements.txt
            pip install -r dev-requirements.txt

            mkdir -p test-reports

      - save_cache:
          paths:
            - ./venv
          key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "dev-requirements.txt" }}

      # run tests!
      - run:
          name: run tests
          command: |
            . venv/bin/activate
            nosetests -v --with-xunit --xunit-file=test-reports/nosetests.xml

      - store_artifacts:
          path: test-reports
          destination: test-reports

      - store_test_results:
          path: test-reports

# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
  build:
    docker:
      - image: circleci/python:3.6
      - image: circleci/mongo:latest

    working_directory: ~/repo

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "dev-requirements.txt" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: install dependencies
          command: |
            python3 -m venv venv
            . venv/bin/activate
            pip install -r requirements.txt
            pip install -r dev-requirements.txt

            mkdir -p test-reports

      - save_cache:
          paths:
            - ./venv
          key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "dev-requirements.txt" }}

      # run tests!
      - run:
          name: run tests
          command: |
            export MONGODB_URI=mongodb://localhost/testing

            . venv/bin/activate
            nosetests -v --with-xunit --xunit-file=test-reports/nosetests.xml

      - store_artifacts:
          path: test-reports
          destination: test-reports

      - store_test_results:
          path: test-reports

Include MongoDB in CircleCI build because it is needed by the tests
Include MongoDB in CircleCI build because it is needed by the tests
