[bug#34515,10/13] gnu: Add python-autobahn.

Message ID 20190219042349.GD2718@jasmine.lan
State Accepted
Headers show
Series None | expand

Checks

Context Check Description
cbaines/applying patch fail Apply failed

Commit Message

Leo Famulari Feb. 19, 2019, 4:23 a.m. UTC
On Mon, Feb 18, 2019 at 09:27:50AM +0100, Ricardo Wurmus wrote:
> Leo Famulari <leo@famulari.name> writes:
> > * gnu/packages/python-web.scm (python-autobahn): New variable.
> […]
> > +    (arguments
> > +     `(#:tests? #f)) ; fail mysteriously
> 
> Mysteriously, eh?  Do you have any more information about this that
> might help us debug this?

Basically, the tests quit early after several errors like this:

------
______ ERROR collecting build/lib/autobahn/nvx/test/test_utf8validator.py ______
import file mismatch:
imported module 'test_utf8validator' has this __file__ attribute:
  /tmp/guix-build-python-autobahn-19.2.1.drv-0/autobahn-19.2.1/autobahn/nvx/test/test_utf8validator.py
which is not the same as the test file we want to collect:
  /tmp/guix-build-python-autobahn-19.2.1.drv-0/autobahn-19.2.1/build/lib/autobahn/nvx/test/test_utf8validator.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
------

I don't fully understand the issue but it's discussed in the pytest bug
tracker as a general issue:

https://github.com/pytest-dev/pytest/issues/529

What do you think? My opinion is that the test suite is broken.

The failure can be reproduced by adding this patch:

Comments

Ricardo Wurmus Feb. 19, 2019, 7:36 a.m. UTC | #1
Leo Famulari <leo@famulari.name> writes:

> On Mon, Feb 18, 2019 at 09:27:50AM +0100, Ricardo Wurmus wrote:
>> Leo Famulari <leo@famulari.name> writes:
>> > * gnu/packages/python-web.scm (python-autobahn): New variable.
>> […]
>> > +    (arguments
>> > +     `(#:tests? #f)) ; fail mysteriously
>>
>> Mysteriously, eh?  Do you have any more information about this that
>> might help us debug this?
>
> Basically, the tests quit early after several errors like this:
>
> ------
> ______ ERROR collecting build/lib/autobahn/nvx/test/test_utf8validator.py ______
> import file mismatch:
> imported module 'test_utf8validator' has this __file__ attribute:
>   /tmp/guix-build-python-autobahn-19.2.1.drv-0/autobahn-19.2.1/autobahn/nvx/test/test_utf8validator.py
> which is not the same as the test file we want to collect:
>   /tmp/guix-build-python-autobahn-19.2.1.drv-0/autobahn-19.2.1/build/lib/autobahn/nvx/test/test_utf8validator.py
> HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
> ------
>
> I don't fully understand the issue but it's discussed in the pytest bug
> tracker as a general issue:
>
> https://github.com/pytest-dev/pytest/issues/529
>
> What do you think? My opinion is that the test suite is broken.

Yeah, I think it’s fine to disable tests in this case.  Would be good to
report this upstream, though.  This might be a Python 2 vs Python 3
difference (due to implicit namespaces in the latter).

--
Ricardo
Leo Famulari Feb. 19, 2019, 7:22 p.m. UTC | #2
On Tue, Feb 19, 2019 at 08:36:26AM +0100, Ricardo Wurmus wrote:
> Yeah, I think it’s fine to disable tests in this case.  Would be good to
> report this upstream, though.  This might be a Python 2 vs Python 3
> difference (due to implicit namespaces in the latter).

I had the same hunch and tried building it with Python 2, but saw the
same failures.

I will report upstream.

Patch

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index c58f358c63..e4ca630498 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -3014,7 +3014,23 @@  high level API for making HTTP requests when using Twisted.")
           "1mm7j24ls01c7jb1ad5p5cpyxvzgydiyf8b04ihykh2v8g98j0x7"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f)) ; fail mysteriously
+     `(#:tests? #t
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'adjust-tests
+           (lambda _
+             ;; This variable chooses whether to use Twisted or
+             ;; asyncio for the tests.
+             (setenv "USE_TWISTED" "true")
+             ;; The require an old pytest because they aim to support
+             ;; Python 3.3.
+             (substitute* "setup.py"
+               (("pytest>=2.8.6,<3.3.0")
+                 "pytest"))
+             #t)))))
+    (native-inputs
+     `(("python-mock" ,python-mock)
+       ("python-pytest" ,python-pytest)))
     (propagated-inputs
      `(("python-cffi" ,python-cffi)
        ("python-twisted" ,python-twisted)