Skip to content

Commit

Permalink
Add needed requirements and tox configuration.
Browse files Browse the repository at this point in the history
To run the tests:
$ pip install -r requirements/devel.txt
$ tox
  • Loading branch information
paetzke committed Jan 11, 2014
1 parent aa41210 commit d073d78
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,6 +1,7 @@
*.pyc
*.pyo
MANIFEST
.coverage
*~

.idea
Expand Down
4 changes: 4 additions & 0 deletions requirements/devel.txt
@@ -0,0 +1,4 @@
-r testing.txt

tox
wheel
2 changes: 2 additions & 0 deletions requirements/testing.txt
@@ -0,0 +1,2 @@
pytest
pytest-cov
6 changes: 6 additions & 0 deletions tox.ini
@@ -0,0 +1,6 @@
[tox]
envlist = py27,py33
toxworkdir = {env:WORKON_HOME}/tox.short_url/
[testenv]
deps = -rrequirements/testing.txt
commands = py.test --cov=short_url --cov-report=term-missing

3 comments on commit d073d78

@Alir3z4
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paetzke I ran the

$ pip install -r requirements/devel.txt
$ tox

I got this;

  File "/home/alireza/dev/pycharm/defEnv/bin/tox", line 8, in <module>
    load_entry_point('tox==1.6.1', 'console_scripts', 'tox')()
  File "/home/alireza/dev/pycharm/defEnv/lib/python2.7/site-packages/tox/_cmdline.py", line 25, in main
    config = parseconfig(args, 'tox')
  File "/home/alireza/dev/pycharm/defEnv/lib/python2.7/site-packages/tox/_config.py", line 44, in parseconfig
    parseini(config, inipath)
  File "/home/alireza/dev/pycharm/defEnv/lib/python2.7/site-packages/tox/_config.py", line 206, in __init__
    "{toxinidir}/.tox")
  File "/home/alireza/dev/pycharm/defEnv/lib/python2.7/site-packages/tox/_config.py", line 420, in getpath
    path = self.getdefault(section, name, defaultpath)
  File "/home/alireza/dev/pycharm/defEnv/lib/python2.7/site-packages/tox/_config.py", line 524, in getdefault
    x = self._replace(x)
  File "/home/alireza/dev/pycharm/defEnv/lib/python2.7/site-packages/tox/_config.py", line 631, in _replace
    return rexpattern.sub(replace_func, x)
  File "/home/alireza/dev/pycharm/defEnv/lib/python2.7/site-packages/tox/_config.py", line 622, in _replace_match_no_quote
    return self._replace_match(match, quote=False)
  File "/home/alireza/dev/pycharm/defEnv/lib/python2.7/site-packages/tox/_config.py", line 617, in _replace_match
    return handler(match, quote)
  File "/home/alireza/dev/pycharm/defEnv/lib/python2.7/site-packages/tox/_config.py", line 554, in _replace_env
    (envkey, envkey))
tox.ConfigError: ConfigError: substitution env:'WORKON_HOME': unkown environment variable 'WORKON_HOME'

Any idea ?

@paetzke
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove line 3 (toxworkdir = {env:WORKON_HOME}/tox.short_url) from tox.ini? Seems you have no environment variable for virtualenv.

@Alir3z4
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It worked:

(defEnv)[alireza@arch short_url]$ vim tox.ini 

GLOB sdist-make: /home/alireza/dev/pycharm/short_url/setup.py
py27 create: /home/alireza/dev/pycharm/short_url/.tox/py27
py27 installdeps: -rrequirements/testing.txt
py27 inst: /home/alireza/dev/pycharm/short_url/.tox/dist/short_url-1.1.zip
py27 runtests: commands[0] | py.test --cov=short_url --cov-report=term-missing
================================================================== test session starts ==================================================================
platform linux2 -- Python 2.7.6 -- pytest-2.5.1
plugins: cov
collected 5 items 

requirements/testing.txt .
tests/test_short_url.py ....
---------------------------------------------------- coverage: platform linux2, python 2.7.6-final-0 ----------------------------------------------------
Name                 Stmts   Miss  Cover   Missing
--------------------------------------------------
short_url/__init__      60      4    93%   115, 119, 123, 127

=============================================================== 5 passed in 0.22 seconds ================================================================
py33 create: /home/alireza/dev/pycharm/short_url/.tox/py33
py33 installdeps: -rrequirements/testing.txt
py33 inst: /home/alireza/dev/pycharm/short_url/.tox/dist/short_url-1.1.zip
py33 runtests: commands[0] | py.test --cov=short_url --cov-report=term-missing
================================================================== test session starts ==================================================================
platform linux -- Python 3.3.3 -- pytest-2.5.1
plugins: cov
collected 5 items 

requirements/testing.txt .
tests/test_short_url.py ....
---------------------------------------------------- coverage: platform linux, python 3.3.3-final-0 -----------------------------------------------------
Name                 Stmts   Miss  Cover   Missing
--------------------------------------------------
short_url/__init__      60      4    93%   115, 119, 123, 127

=============================================================== 5 passed in 0.43 seconds ================================================================
________________________________________________________________________ summary ________________________________________________________________________
  py27: commands succeeded
  py33: commands succeeded
  congratulations :)

Please sign in to comment.