Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project Structure And Tox #24

Closed
peteut opened this issue Jan 10, 2019 · 5 comments
Closed

Project Structure And Tox #24

peteut opened this issue Jan 10, 2019 · 5 comments
Labels

Comments

@peteut
Copy link
Contributor

peteut commented Jan 10, 2019

May you accept a pull request to prevent potential issues when using with tox?
As described in [1] best practice is to use a structure like this if used with tox [2]:

setup.py
src/
    mypkg/
        __init__.py
        app.py
        view.py
tests/
    __init__.py
    foo/
        __init__.py
        test_view.py
    bar/
        __init__.py
        test_view.py

The proposed project structure is used for instance in [3].

[1] Pytest:: Choosing a test layout / import rules
[2] Welcome to the tox automation project
[3] migen-axi

@whitequark
Copy link
Contributor

So what is achieved here, exactly?

@peteut
Copy link
Contributor Author

peteut commented Jan 13, 2019

@whitequark tox comes in handy to test against insulated Python environments where the packet to test gets installed prior testing. The configuration is stored in tox.ini:

[tox]
envlist = py36,py37

[base]
deps =
    -rdev-requirements.txt
    -rrequirements.txt

[testenv]
deps =
    {[base]deps}
commands =
    coverage run -m pytest {posargs}
    coverage combine .coverage
    coverage report

[travis]
python =
    3.6: py36
    3.7: py37

Using tox-travis [1] .travis.yml could look like this:

sudo: false
dist: xenial
language: python
python:
  - "3.6"
  - "3.7"
cache:
  directories:
    - "$HOME/.ccache"
    - "$HOME/.local"
before_install:
  - export PATH="/usr/lib/ccache:$HOME/.local/bin:$PATH"
install:
  - pip install -rdev-requirements.txt
  - pip install coveralls
  - pip install tox-travis
  - git clone --depth=1 https://github.com/YosysHQ/yosys
  - (cd yosys && if ! yosys -V || [ $(git rev-parse HEAD $(yosys -V | awk 'match($0,/sha1 ([0-9a-f]+)/,m) { print m[1] }') | uniq | wc -l) != 1 ]; then make CONFIG=gcc ENABLE_ABC=0 PREFIX=$HOME/.local install; fi)
script:
  - tox
after_success:
  - coveralls

[1] tox-travis

@whitequark
Copy link
Contributor

This is redundant with Travis.

@peteut
Copy link
Contributor Author

peteut commented Jan 14, 2019

This is redundant with Travis.

That's right, Travis Python containers have only a couple of packages pre-installed which should not harm.

@peteut
Copy link
Contributor Author

peteut commented Jan 17, 2019

Not need, as Travis is used for insulation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants