Skip to content

Commit

Permalink
amended dockerfile and contibuting.mdso contributors can be made more…
Browse files Browse the repository at this point in the history
… aware of testing issues
  • Loading branch information
chrisbeardy committed Oct 4, 2020
1 parent c7ad2d6 commit e349a9a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@ the unit tests with the code in the PR and report back.
[Github]: https://github.com/stlehmann/pyads/pulls
[Travis]: https://travis-ci.org/stlehmann/pyads

### Testing issues on Windows

There are known issues when running tests using a Windows development environment with
TwinCat installed; TwinCat can cause issues with the ADS Test Server. If running tests
using tox causes problems, tests can be run using Docker instead.

With Docker installed docker images can be built and run for any python version.
The following commands will build an image using python3.8, then tests will run when the
container starts:

```
docker build --build-arg python_version=3.8 -t container_name .
docker run --rm container_name
```

The container is deleted automatically after running so that multiple containers don't
build up on the system. To rerun the tests after making changes to pyads, any docker images
will need to be rebuilt.


## Documentation contributions

Sphinx is used to create the documentation from source files and docstrings in code.
Expand Down
13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
FROM python:3.7
# This Dockerfile is for running the tests on a windows system where the
# TwinCat router can interfere with the tests. In the first instance tests should be run with tox.

ARG python_version=3.8

# Build python environment and setup pyads
FROM python:${python_version}
COPY . /pyads
WORKDIR /pyads
RUN python setup.py build
RUN python setup.py develop
CMD python setup.py test

# Test commands
RUN pip install pytest
CMD pytest

0 comments on commit e349a9a

Please sign in to comment.