Closed blueskyjunkie closed 7 years ago
So if you remove the __version__
line, it works? That would be a workaround. If it still fails, then something else is wrong.
But it sounds like you haven't installed the package yet. When the current directory contains the setup.py
of your registerMap
package, this should to the trick:
/venv/bin/python setup.py develop
If I remove the __version__
line, the unit tests work. Strangely, running the unittests at the top level of the project from PyCharm works just fine regardless, but I don't seem to be able to find exactly what magic PyCharm is doing when it runs nosetest.
It's true that in my CI build or just running from my source folder as I'm editing, I haven't installed the package yet, but why should I need to, except to fool the pkg_resources library into thinking it has what it needs for __version__
?
In any case, for the CI build, running your suggested python setup does enable the unit tests to work.
Thanks for your help.
The code you were using for __version__
asks pkg_resources for information about a package. "So" pkg_resources needs to know about the packages. "So" it must be installed.
It probably works when running from the source folder because the top level directory can be found.
It probably works when running from the source folder because the top level directory can be found.
That suggests that there is an incantation that PyCharm is using that doesn't require installation of the library, no?
Is it as simple as adding my source library to PYTHONPATH before invoking nosetests?
That might help yes. I have PyCharm, but haven't used it much yet.
I've used the zest.releaser recommended version configuration from here http://zestreleaser.readthedocs.io/en/latest/versions.html#using-the-version-number-in-setup-py-and-as-version
This seems to be interfering with unittests run on the source using nosetests in my build system.
I assume the problem is that because my package hasn't been properly "installed" in a virtualenv or whatever, that the version configuration doesn't work properly.
I'm new to Python packaging and zest.releaser, so it's possible, even likely, that there is a known solution to this either in nosetests configuration, or in a methodology change.
I haven't discovered anything in searching. The one idea I had was to do a 'dev' installation of my project (which I don't yet know how to do, but setup.py seems to suggests it is possible) in the build and then run unittests from that. This seems like a complex solution to something that probably is a configuration problem.
If you can suggest a work around I would be most grateful.