aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2021-12-28 14:30:45 -0800
committerGravatar MarkKoz <[email protected]>2021-12-28 14:31:51 -0800
commit4152f68e357b6aceabc88b252bcd5f83b81c3a12 (patch)
treedfda001930bc3110c2edea46edd1d49176728a7d
parentDo not run Kubernetes deployment on self-hosted runner (diff)
Store relative paths in coverage data
Also remove the reliance on the container needing to mount the host's files to the same directory during local testing. Fix #135
-rw-r--r--.coveragerc3
-rw-r--r--DEVELOPING.md6
-rw-r--r--docker-compose.yml4
3 files changed, 6 insertions, 7 deletions
diff --git a/.coveragerc b/.coveragerc
index cd0ab81..cc2a148 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -1,9 +1,10 @@
[run]
-branch = True
+branch = true
include = snekbox/*
omit =
snekbox/api/app.py
snekbox/config_pb2.py
+relative_files = true
[report]
exclude_lines =
diff --git a/DEVELOPING.md b/DEVELOPING.md
index fdda51a..0dbf4cc 100644
--- a/DEVELOPING.md
+++ b/DEVELOPING.md
@@ -30,8 +30,6 @@ docker-compose up
The container has all development dependencies. The repository on the host is mounted within the container; changes made to local files will also affect the container.
-Note that the compose file depends on the environment variable `PWD` being set to the current working directory. It needs it to create the aforementioned bind mount. Unix shells normally have this set already. If for some reason it is not set, it needs to be manually set. A convenient way to set it is to define it in a `.env` file which Docker Compose will automatically read.
-
To build a normal container that can be used in production, run
```
@@ -62,7 +60,9 @@ Alternatively, a report can be generated as HTML with
pipenv run coverage html
```
-The HTML will output to `./htmlcov/` by default
+The HTML will output to `./htmlcov/` by default.
+
+The report cannot be generated on Windows directly due to the difference in file separators in the paths. Instead, launch a shell in the container (see below) and use `coverage report` or `coverage html` (do not invoke through Pipenv).
## Launching a Shell in the Container
diff --git a/docker-compose.yml b/docker-compose.yml
index f546024..3854825 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -11,10 +11,8 @@ services:
init: true
ipc: none
tty: true
- working_dir: $PWD
environment:
DEBUG: 1
- PIPENV_PIPFILE: /snekbox/Pipfile
PYTHONDONTWRITEBYTECODE: 1
build:
context: .
@@ -24,7 +22,7 @@ services:
cache_from:
- ghcr.io/python-discord/snekbox:latest
volumes:
- - $PWD:$PWD
+ - .:/snekbox
- user-base:/snekbox/user_base
volumes: