"""
-class our_build_ext(build_ext):
+class psycopg3_build_ext(build_ext):
def finalize_options(self) -> None:
self._setup_ext_build()
super().finalize_options()
- def run(self) -> None:
- super().run()
-
def _setup_ext_build(self) -> None:
+ # Clear the dummy so if we can't build it's no drama
+ self.distribution.ext_modules = None
+
try:
from Cython.Build import cythonize
except ImportError:
"Issue Tracker": "https://github.com/psycopg/psycopg3/issues",
"Download": "https://pypi.org/project/psycopg3/",
},
- cmdclass={"build_ext": our_build_ext},
+ cmdclass={"build_ext": psycopg3_build_ext},
+ # hack to run build_ext. It will be replaced by real the stuff
+ ext_modules=[Extension("psycopg3.dummy", ["dummy.c"])],
)
envlist = py{36,37,38}, black, flake8, mypy
[testenv]
-commands = pytest {posargs}
-passenv = PG* PSYCOPG3_TEST_DSN PYTEST_ADDOPTS
+# run setup.py develop to build the c extension in place.
+# if this doesn't happen, psycopg3 will be imported from the root directory
+# anyway rather than from the tox environment, because pytest adds the
+# root dir to the pythonpath. It sucks but I don't see a way around.
+commands =
+ python setup.py develop
+ pytest {posargs}
+passenv = PG* PSYCOPG3_TEST_DSN PYTEST_ADDOPTS PSYCOPG3_IMPL
deps = pytest >= 5.3,<6
[testenv:black]