diff --git a/.coveragerc b/.coveragerc index 1fa8baaf..058b775b 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,5 @@ [run] +data_file = /tmp/.coverage branch = True omit = notesserver/settings* *wsgi.py diff --git a/.pii_annotations.yml b/.pii_annotations.yml index 683971ee..70d5db8b 100644 --- a/.pii_annotations.yml +++ b/.pii_annotations.yml @@ -1,5 +1,5 @@ source_path: ./ -report_path: pii_report +report_path: /tmp/pii_report safelist_path: .annotation_safe_list.yml coverage_target: 100.0 annotations: diff --git a/.travis/docker-compose-travis.yml b/.travis/docker-compose-travis.yml index ad59a326..b70d9de0 100644 --- a/.travis/docker-compose-travis.yml +++ b/.travis/docker-compose-travis.yml @@ -15,15 +15,15 @@ services: image: elasticsearch:1.5.2 container_name: es notes: - # Uncomment this line to use the official course-discovery base image - image: edxops/notes:latest + image: openedx/edx-notes-api:latest # Uncomment the next two lines to build from a local configuration repo # build: ../configuration/docker/build/discovery/ container_name: edx_notes_api volumes: - - ..:/edx/app/edx_notes_api/edx_notes_api + - ..:/edx/app/notes + - ./edx_notes_api.yml:/edx/etc/edx_notes_api.yml command: tail -f /dev/null depends_on: - "db" diff --git a/.travis/docker.mk b/.travis/docker.mk index 194f79f5..5faf36bf 100644 --- a/.travis/docker.mk +++ b/.travis/docker.mk @@ -7,10 +7,12 @@ travis_start: ## Start containers stopped by `travis_stop` docker-compose -f .travis/docker-compose-travis.yml start travis_test: ## Run tests on Docker containers, as on Travis CI - docker exec -e TERM=$(TERM) -e TOXENV=$(TOXENV) -it edx_notes_api /edx/app/edx_notes_api/edx_notes_api/.travis/run_tests.sh + docker exec -e TERM=$(TERM) -e TOXENV=$(TOXENV) -it edx_notes_api /edx/app/notes/.travis/run_tests.sh + docker exec -it edx_notes_api env TERM=$(TERM) /edx/app/notes/.travis/run_tests.sh travis_pii_check: ## Run pii annotations checker on Docker containers, as on Travis CI - docker exec -e TERM=$(TERM) -e TOXENV=$(TOXENV) -it edx_notes_api /edx/app/edx_notes_api/edx_notes_api/.travis/run_pii_checker.sh + docker exec -e TERM=$(TERM) -e TOXENV=$(TOXENV) -it edx_notes_api /edx/app/notes/.travis/run_pii_checker.sh + docker exec -it edx_notes_api env TERM=$(TERM) /edx/app/notes/.travis/run_pii_checker.sh travis_stop: ## Stop running containers created by `travis_up` without removing them docker-compose -f .travis/docker-compose-travis.yml stop diff --git a/.travis/edx_notes_api.yml b/.travis/edx_notes_api.yml new file mode 100644 index 00000000..6c5ea951 --- /dev/null +++ b/.travis/edx_notes_api.yml @@ -0,0 +1,9 @@ +DATABASES: + default: + ENGINE: "django.db.backends.mysql" + HOST: "db" + NAME: "edx_notes_api" + PASSWORD: "secret" + PORT: "3306" + USER: "notes001" +ELASTICSEARCH_URL: "http://es:9200" diff --git a/.travis/run_pii_checker.sh b/.travis/run_pii_checker.sh index 38865a7e..72f27586 100755 --- a/.travis/run_pii_checker.sh +++ b/.travis/run_pii_checker.sh @@ -1,9 +1,8 @@ #!/bin/bash -xe -. /edx/app/edx_notes_api/venvs/edx_notes_api/bin/activate export DJANGO_SETTINGS_MODULE=notesserver.settings.test -cd /edx/app/edx_notes_api/edx_notes_api +cd /edx/app/notes -make pii_check +PATH=/home/app/.local/bin:$PATH make pii_check diff --git a/.travis/run_tests.sh b/.travis/run_tests.sh index ce339950..3c492a64 100755 --- a/.travis/run_tests.sh +++ b/.travis/run_tests.sh @@ -1,7 +1,6 @@ #!/bin/bash -xe -. /edx/app/edx_notes_api/venvs/edx_notes_api/bin/activate -cd /edx/app/edx_notes_api/edx_notes_api +cd /edx/app/notes -make validate +PATH=/home/app/.local/bin:$PATH make validate diff --git a/Makefile b/Makefile index 87a171fd..b31a205f 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ include .travis/docker.mk validate: test.requirements test test: clean - $(TOX)python -Wd -m pytest + $(TOX)python3 -Wd -m pytest pii_check: test.requirements pii_clean code_annotations django_find_annotations --config_file .pii_annotations.yml \ @@ -26,8 +26,8 @@ clean: coverage erase pii_clean: - rm -rf pii_report - mkdir -p pii_report + rm -rf /tmp/pii_report + mkdir -p /tmp/pii_report quality: pep8 --config=.pep8 $(PACKAGES) @@ -43,24 +43,24 @@ diff-quality: coverage: diff-coverage diff-quality create-index: - python manage.py rebuild_index + python3 manage.py rebuild_index migrate: - python manage.py migrate --noinput + python3 manage.py migrate --noinput static: # provide the static target for devstack's tooling. @echo "The notes service does not need staticfiles to be compiled. Skipping." requirements: - pip install -q -r requirements/base.txt --exists-action=w + pip install --user -q -r requirements/base.txt --exists-action=w test.requirements: requirements - pip install -q -r requirements/test.txt --exists-action=w + pip install --user -q -r requirements/test.txt --exists-action=w develop: test.requirements piptools: ## install pinned version of pip-compile and pip-sync - pip install -r requirements/pip-tools.txt + pip install --user -r requirements/pip-tools.txt upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade upgrade: piptools ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in diff --git a/manage.py b/manage.py index 746c5d00..71a72ae4 100755 --- a/manage.py +++ b/manage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys