tox

How to import all the environment variables in tox

懵懂的女人 提交于 2019-12-21 07:08:46
问题 I'm using following in setenv to import the environment variable from where I run, but is there a way to import all the variables so that I don't really need to import one by one. e.g: {env:TEMPEST_CONFIG:} and {env:TEMPEST_CONFIG_DIR:} used to import these 2 variables. [testenv:nosetests] setenv = TEMPEST_CONFIG={env:TEMPEST_CONFIG:} TEMPEST_CONFIG_DIR={env:TEMPEST_CONFIG_DIR:} deps = {[testenv]deps} commands = find . -type f -name "*.pyc" -delete bash {toxinidir}/tools/setup.sh nosetests -

Reinstall virtualenv with tox when requirements.txt or setup.py changes

倖福魔咒の 提交于 2019-12-21 04:02:12
问题 Previously I was manually using a Makefile that looked something like this: .PHONY: all all: tests .PHONY: tests tests: py_env bash -c 'source py_env/bin/activate && py.test tests' py_env: requirements_dev.txt setup.py rm -rf py_env virtualenv py_env bash -c 'source py_env/bin/activate && pip install -r requirements_dev.txt' This had the nice side-effect that if I changed requirements_dev.txt or setup.py, it would rebuild my virtualenv. But feels a bit clunky. I'd like to use tox to do a

How to run Tox with Travis-CI

丶灬走出姿态 提交于 2019-12-20 09:29:38
问题 How do you test different Python versions with Tox from within Travis-CI? I have a tox.ini : [tox] envlist = py{27,33,34,35} recreate = True [testenv] basepython = py27: python2.7 py33: python3.3 py34: python3.4 py35: python3.5 deps = -r{toxinidir}/pip-requirements.txt -r{toxinidir}/pip-requirements-test.txt commands = py.test which runs my Python unittests in several Python versions and works perfectly. I want to setup a build in Travis-CI to automatically run this when I push changes to

How to change Tox command with command-line parameters

独自空忆成欢 提交于 2019-12-19 17:44:11
问题 How do you append options to the command Tox runs by appending that option to Tox? Specifically, how do you run a specific Django unittest with Tox? I'm trying to wrap Tox around some Django unittests, and I can run all unittests with tox , which runs django-admin.py test --settings=myapp.tests.settings myapp.tests.Tests . However, I'd like to run a specific test at myapp.tests.Tests.test_somespecificthing , which would mean telling Tox to append ".test_somespecificthing" to the end of the

Inconsistent results with Travis CI and tox

心已入冬 提交于 2019-12-12 03:19:08
问题 I have set up continuous integration for my open source project at Travis. tox seems to be having some problems with quotes in the commands, so I set up a temporary branch for debugging the problem. At this point I am encountering a very strange issue. The last 3 commits and their build status on Travis: Bla - build 32 passed eklzjfljkze - build 32 failed Revert "eklzjfljkze" - build 34 failed As the last commit reverts the one that caused the failure, I see no reason why build 34 shouldn't

How do the arguments are being passed to test functions in tox/py.test?

女生的网名这么多〃 提交于 2019-12-12 02:07:50
问题 I'm learning to write tests with tox. How do the arguments are being passed to test functions in tox/py.test? For example in test_simple_backup_generation from tests/test_backup_cmd.py of django-backup extension there are three arguments tmpdir , settings , db . I don't have any idea where they came from. It's nothing said about this in tox documentation either. 回答1: These are pytest fixtures provided by pytest-django and pytest itself. 来源: https://stackoverflow.com/questions/39018056/how-do

travis secure env variables not used in tox

为君一笑 提交于 2019-12-11 12:35:33
问题 I can see in my travis build log that env variables are exported correctly : Setting environment variables from .travis.yml $ export K_API_KEY=[secure] $ export K_PRIVATE_KEY=[secure] $ export TOXENV=py27 However they aren't picked in my tests which use a basic config.py file that just should get the env variables this way ( API_KEY = os.environ['K_API_KEY'] ), see relevant travis log: $ source ~/virtualenv/python2.7/bin/activate $ python --version Python 2.7.9 $ pip --version pip 6.0.7 from

Testing a python script in a specific version

守給你的承諾、 提交于 2019-12-11 03:22:59
问题 I currently have Python 2.6.2 installed on my mac. I am writing a script which MUST run on Python 2.5.2. So I want to write a python script, and test is specifically against 2.5.2 and NOT 2.6.2. I was looking at virtualenv, but it doesn't seem to solve my problem. I ran python virtualenv.py TEST which made a TEST dir, but it had python 2.6 in it. Is there a way to make virtualenv use a different version of python than what's installed default on my machine? Is another way to use the #! as the

AttributeError: <module '__main__' from [..] does not have the attribute 'open'

删除回忆录丶 提交于 2019-12-11 02:39:34
问题 I'm working on writing a test for a module for docker-py, but I can't seem to get the test to work properly. The function I'm testing looks as follows: def parse_env_file(env_file): """ Reads a line-separated environment file. The format of each line should be "key=value". """ environment = [] if os.path.isfile(env_file): with open(env_file, 'r') as f: # We can't use f.readlines() here as it's not implemented in Mock for line in f.read().split('\n'): parse_line = line.strip().split('=') if

What should a Python project structure look like for Travis CI to find and run tests?

天涯浪子 提交于 2019-12-09 18:11:43
问题 I currently have a project with the following .travis.yml file: language: python install: "pip install tox" script: "tox" Locally, tox properly executes and runs 35 tests, but on Travis CI, it runs 0 tests . More details: https://travis-ci.org/neverendingqs/pyiterable/builds/78954867 I also tried other ways, including: language: python python: - "2.6" - "2.7" - "3.2" - "3.3" - "3.4" - "3.5.0b3" - "3.5-dev" - "nightly" # also fails with just `nosetest` and no `install` step install: "pip