I'm currently trying to make a module written for Python2 compatible with Python3.2.
I started by making sure that all code can be automatically converted with 2to3
and added into setup.py:
use_2to3 = True,
So far, everything is working fine.
Now, I want to test the converted files.
The tests are written such that they can run without 2to3
.
My folder structure is:
# ls /path/to/mymodule
setup.py
mymodule/
tests/
build/
To my setup.py, I added
test_suite = "tests",
Now I execute
rm -rf build/
python3 setup.py build
python3 setup.py test
in order to test my automatically converted code.
But it fails because the test still runs on the mymodule
directory:
File "/path/to/mymodule/mymodule/main.py", line 35
logger.info(u'Scanning {path}'.format(path=self.path))
^
SyntaxError: invalid syntax
[This Syntax error is in MODULE code, not in TEST code.]
[I expect the path to be: /path/to/mymodule/build/lib/mymodule/main.py]
In my build/
are the correctly converted files.
If distribute is converting them correctly, why aren't the tests also executed for the converted files?
Am I missing something? I already checked the documentation of setuptools/distribute for a missing parameter. I don't want to include my tests into the module, as there are several resource files just for testing that would take up unnecessary space.
=> Can I configure my setup.py to run the tests for a different folder when running in python3?