Skip to content

Commit

Permalink
Store relative paths in coverage data
Browse files Browse the repository at this point in the history
Fix paths being mismatched when trying to combine coverage data from
the matrix jobs in CI. Also remove the reliance on the container needing
to mount the host's files to the same directory during local testing.

Fix #135
  • Loading branch information
MarkKoz committed Dec 28, 2021
1 parent 94627e2 commit e12af36
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down
6 changes: 3 additions & 3 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand Down Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
Expand All @@ -24,7 +22,7 @@ services:
cache_from:
- ghcr.io/python-discord/snekbox:latest
volumes:
- $PWD:$PWD
- .:/snekbox
- user-base:/snekbox/user_base

volumes:
Expand Down

0 comments on commit e12af36

Please sign in to comment.