Skip to content

Commit 4152f68

Browse files
committed
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
1 parent 94627e2 commit 4152f68

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

.coveragerc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[run]
2-
branch = True
2+
branch = true
33
include = snekbox/*
44
omit =
55
snekbox/api/app.py
66
snekbox/config_pb2.py
7+
relative_files = true
78

89
[report]
910
exclude_lines =

DEVELOPING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ docker-compose up
3030

3131
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.
3232

33-
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.
34-
3533
To build a normal container that can be used in production, run
3634

3735
```
@@ -62,7 +60,9 @@ Alternatively, a report can be generated as HTML with
6260
pipenv run coverage html
6361
```
6462

65-
The HTML will output to `./htmlcov/` by default
63+
The HTML will output to `./htmlcov/` by default.
64+
65+
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).
6666

6767
## Launching a Shell in the Container
6868

docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ services:
1111
init: true
1212
ipc: none
1313
tty: true
14-
working_dir: $PWD
1514
environment:
1615
DEBUG: 1
17-
PIPENV_PIPFILE: /snekbox/Pipfile
1816
PYTHONDONTWRITEBYTECODE: 1
1917
build:
2018
context: .
@@ -24,7 +22,7 @@ services:
2422
cache_from:
2523
- ghcr.io/python-discord/snekbox:latest
2624
volumes:
27-
- $PWD:$PWD
25+
- .:/snekbox
2826
- user-base:/snekbox/user_base
2927

3028
volumes:

0 commit comments

Comments
 (0)