version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
      - image: circleci/python:3.6.1

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/postgres:9.4

    working_directory: ~/repo

    steps:
      - checkout

      # store dependencies information in a single file
      # so that it can be used with checksum
      - run: ls -laR backend/requirements
      - run: ls -laR backend/requirements > backend_deps_checksum

      # Download and cache dependencies
      - restore_cache:
          keys:
          - backend-{{ checksum "backend_deps_checksum" }}

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

      - save_cache:
          paths:
            - ./venv
          key: backend-{{ checksum "backend_deps_checksum" }}

      - run:
          name: run tests
          command: |
            . venv/bin/activate
            cd backend
            py.test


version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
      - image: circleci/python:3.6.1

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/postgres:9.4

    working_directory: ~/repo

    steps:
      - checkout

      # store dependencies md5 in a single file
      # so that it can be used with checksum
      - run: find backend/requirements -type f -exec md5sum {} \; | sort -k 2 | md5sum > backend_deps_checksum

      # Download and cache dependencies
      - restore_cache:
          keys:
          - backend-{{ checksum "backend_deps_checksum" }}

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

      - save_cache:
          paths:
            - ./venv
          key: backend-{{ checksum "backend_deps_checksum" }}

      - run:
          name: run tests
          command: |
            . venv/bin/activate
            cd backend
            py.test


Use md5 instead of ls -laR
Use md5 instead of ls -laR
