Segfault-Inc / Multicorn

Data Access Library
https://multicorn.org/
PostgreSQL License
700 stars 145 forks source link

multicorn/fsfdw/test.py: fixture 'tempdir' not found #124

Closed df7cb closed 8 years ago

df7cb commented 8 years ago

Hi,

thanks for fixing the regression test failures spotted by the Debian build system in #112.

Unfortunately the tests still don't work:

====================================================== test session starts =======================================================
platform linux -- Python 3.4.4, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
rootdir: /home/cbe/projects/postgresql/multicorn/Multicorn, inifile: setup.cfg
collected 7 items 

multicorn/fsfdw/test.py EEEEEEE

============================================================= ERRORS =============================================================
_________________________________________________ ERROR at setup of test_parser __________________________________________________
file /home/cbe/projects/postgresql/multicorn/Multicorn/.pybuild/pythonX.Y_3.4/build/multicorn/fsfdw/test.py, line 47
  @with_tempdir
  def test_parser(tempdir):
        fixture 'tempdir' not found
        available fixtures: tmpdir, record_xml_property, pytestconfig, tmpdir_factory, capsys, cache, recwarn, capfd, monkeypatch
        use 'py.test --fixtures [testpath]' for help on them.

/home/cbe/projects/postgresql/multicorn/Multicorn/.pybuild/pythonX.Y_3.4/build/multicorn/fsfdw/test.py:47
________________________________________________ ERROR at setup of test_filenames ________________________________________________
file /home/cbe/projects/postgresql/multicorn/Multicorn/.pybuild/pythonX.Y_3.4/build/multicorn/fsfdw/test.py, line 90
  @with_tempdir
  def test_filenames(tempdir):
        fixture 'tempdir' not found
        available fixtures: tmpdir, record_xml_property, pytestconfig, tmpdir_factory, capsys, cache, recwarn, capfd, monkeypatch
        use 'py.test --fixtures [testpath]' for help on them.
... and a few more

I had tried to fix this using some sort of s/tempdir/tmpdir/, but then I ran into other problems with the rst test at the end of that file where "assert extract('third.rst') == meta_1" was failing, so I left the testsuite in the Debian package disabled for now.

The paste above is for git head; the full Debian build log for 1.2.4 is at https://buildd.debian.org/status/fetch.php?pkg=postgresql-multicorn&arch=arm64&ver=1.2.4-1&stamp=1450804326

rdunklau commented 8 years ago

The "real" test suite is the one launched by "make installcheck": pure python tests aren't really testing much, it would be best to test using make installcheck against a live running PostgreSQL installation.

How are you running tests for other PostgreSQL extensions in debian packages ?

I'm using nosetests to run the tests, which works fine with the tests written as is. To keep the compatibility between the two, I have a first fix which manually wraps the function (instead of using functools.wraps) to not expose an argument that py.test will try to magically convert to a fixture: 19315190b102b231c2fc14aa32437ad522c38c8f

The tests now works on both py.test and nose. I still have to correct some things so that the tests pass in python3 as well, but that should be easy.

rdunklau commented 8 years ago

The fix for python3 is there: b76a310799131fae7b95db932024a4854839c267