Open offlinehacker opened 11 years ago
How did you run tests? We recommend you to use tox
e.g.:
$ tox # tests run on py26,py27,py32,py33, and pypy
$ tox -e py27,py33 # tests run on only py27 and py33
$ tox -- -k store # `-k store` option is forwarded to py.test
I'm making a package for linux distribution, more precisely nixos (it is standard that if we can test a package, package is tested after build phase). I tried both the standard setuptools "python setup.py test" and "py.test", and both failed with same error. I'm testing only for a singe python version, because we have different packages per python versions.
On Fri, Sep 20, 2013 at 4:13 PM, Hong Minhee notifications@github.comwrote:
How did you run tests? We recommend you to use toxhttp://testrun.org/tox/e.g.:
$ tox # tests run on py26,py27,py32,py33, and pypy$ tox -e py27,py33 # tests run on only py27 and py33$ tox -- -k store #
-k store
option is forwarded to py.test— Reply to this email directly or view it on GitHubhttps://github.com/crosspop/sqlalchemy-imageattach/issues/14#issuecomment-24813054 .
Invoking py.test
(without any arguments) must simply work. Did you happen to run tests in tests/
directory? It should be run at root of the source tree.
I run it from root of the tree and i get this error. How could i debug this any further?
On Fri, Sep 20, 2013 at 8:19 PM, Hong Minhee notifications@github.comwrote:
Invoking py.test (without any arguments) must simply work. Did you happen to run tests in tests/ directory? It should be run at root of the source tree.
— Reply to this email directly or view it on GitHubhttps://github.com/crosspop/sqlalchemy-imageattach/issues/14#issuecomment-24830368 .
And yes, i'm using python 2.7
On Fri, Sep 20, 2013 at 11:41 PM, Jaka Hudoklin jakahudoklin@gmail.comwrote:
I run it from root of the tree and i get this error. How could i debug this any further?
On Fri, Sep 20, 2013 at 8:19 PM, Hong Minhee notifications@github.comwrote:
Invoking py.test (without any arguments) must simply work. Did you happen to run tests in tests/ directory? It should be run at root of the source tree.
— Reply to this email directly or view it on GitHubhttps://github.com/crosspop/sqlalchemy-imageattach/issues/14#issuecomment-24830368 .
I just noticed that the error type is not ImportError
but ValueError
. Can I see the more detailed trackback? Try -vv
option.
Okay here is the whole backtrace:
============================= test session starts ==============================
platform linux2 -- Python 2.7.5 -- pytest-2.3.5 -- /nix/store/1i5rd0mp4x57gzjii9z2pg3mjgzj95q6-python-2.7.5/bin/python2.7
collecting ... collected 0 items / 1 errors
==================================== ERRORS ====================================
______________________________ ERROR collecting . ______________________________
/nix/store/r845pd45751jzbi1fg8dng571hpfpmh6-python2.7-py-1.4.13/lib/python2.7/site-packages/py-1.4.13-py2.7.egg/py/_path/common.py:315: in visit
> for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/nix/store/r845pd45751jzbi1fg8dng571hpfpmh6-python2.7-py-1.4.13/lib/python2.7/site-packages/py-1.4.13-py2.7.egg/py/_path/common.py:361: in gen
> for p in self.gen(subdir):
/nix/store/r845pd45751jzbi1fg8dng571hpfpmh6-python2.7-py-1.4.13/lib/python2.7/site-packages/py-1.4.13-py2.7.egg/py/_path/common.py:351: in gen
> if p.check(dir=1) and (rec is None or rec(p))])
/nix/store/f5g5l96afv66zqr34n3krswc7wzq1mf0-python2.7-pytest-2.3.5/lib/python2.7/site-packages/pytest-2.3.5-py2.7.egg/_pytest/main.py:548: in _recurse
> ihook.pytest_collect_directory(path=path, parent=self)
/nix/store/f5g5l96afv66zqr34n3krswc7wzq1mf0-python2.7-pytest-2.3.5/lib/python2.7/site-packages/pytest-2.3.5-py2.7.egg/_pytest/main.py:158: in call_matching_hooks
> plugins = self.config._getmatchingplugins(self.fspath)
/nix/store/f5g5l96afv66zqr34n3krswc7wzq1mf0-python2.7-pytest-2.3.5/lib/python2.7/site-packages/pytest-2.3.5-py2.7.egg/_pytest/config.py:319: in _getmatchingplugins
> plugins += self._conftest.getconftestmodules(fspath)
/nix/store/f5g5l96afv66zqr34n3krswc7wzq1mf0-python2.7-pytest-2.3.5/lib/python2.7/site-packages/pytest-2.3.5-py2.7.egg/_pytest/config.py:214: in getconftestmodules
> clist.append(self.importconftest(conftestpath))
/nix/store/f5g5l96afv66zqr34n3krswc7wzq1mf0-python2.7-pytest-2.3.5/lib/python2.7/site-packages/pytest-2.3.5-py2.7.egg/_pytest/config.py:243: in importconftest
> self._conftestpath2mod[conftestpath] = mod = conftestpath.pyimport()
/nix/store/r845pd45751jzbi1fg8dng571hpfpmh6-python2.7-py-1.4.13/lib/python2.7/site-packages/py-1.4.13-py2.7.egg/py/_path/local.py:548: in pyimport
> __import__(modname)
tests/stores/conftest.py:7: in <module>
> from ..conftest import Base
E ValueError: Attempted relative import beyond toplevel package
Sorry for wierd paths, but that is how nix package manager works (stores everything under /nix/store/hash+package_name).
Could you paste the output of tree
command from root of the source tree as well?
Okay i think i now see the problem too, looks like not all files are included in pypi archive. For now i will just switch to git as a source, but it would be nice to include missing files.
Here is output of tree, right after failed tests. Sorry for those ugly chars, terminal copy makes problems.
.
âââ build
â  âââ bdist.linux-x86_64
â  âââ lib
â  âââ sqlalchemy_imageattach
â  âââ context.py
â  âââ entity.py
â  âââ file.py
â  âââ __init__.py
â  âââ migration.py
â  âââ store.py
â  âââ stores
â  â  âââ fs.py
â  â  âââ __init__.py
â  â  âââ s3.py
â  âââ util.py
â  âââ version.py
âââ PKG-INFO
âââ README.rst
âââ setup.cfg
âââ setup.py
âââ sqlalchemy_imageattach
â  âââ context.py
â  âââ entity.py
â  âââ file.py
â  âââ __init__.py
â  âââ __init__.pyc
â  âââ migration.py
â  âââ store.py
â  âââ stores
â  â  âââ fs.py
â  â  âââ __init__.py
â  â  âââ s3.py
â  âââ util.py
â  âââ version.py
â  âââ version.pyc
âââ SQLAlchemy_ImageAttach.egg-info
â  âââ dependency_links.txt
â  âââ PKG-INFO
â  âââ requires.txt
â  âââ SOURCES.txt
â  âââ top_level.txt
âââ temp
âââ tests
âââ stores
âââ conftest.py
âââ conftest.pyc
âââ fs_test.py
âââ __init__.py
âââ __init__.pyc
âââ s3_test.py
That’s indeed problematic, so I will include these missing files as well. Thanks!
tests/stores/conftest.py:7: in
I'm using pytest 2.3.5
How can i solve this? thanks!