From pylucene-dev-return-3082-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Thu Oct 17 17:57:05 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id D9ED0180657 for ; Thu, 17 Oct 2019 19:57:04 +0200 (CEST) Received: (qmail 59969 invoked by uid 500); 17 Oct 2019 17:57:04 -0000 Mailing-List: contact pylucene-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pylucene-dev@lucene.apache.org Delivered-To: mailing list pylucene-dev@lucene.apache.org Received: (qmail 59957 invoked by uid 99); 17 Oct 2019 17:57:04 -0000 Received: from Unknown (HELO mailrelay1-lw-us.apache.org) (10.10.3.42) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Oct 2019 17:57:04 +0000 Received: from [100.73.32.196] (unknown [104.132.11.100]) by mailrelay1-lw-us.apache.org (ASF Mail Server at mailrelay1-lw-us.apache.org) with ESMTPSA id B3FAA598D for ; Thu, 17 Oct 2019 17:57:03 +0000 (UTC) Date: Thu, 17 Oct 2019 10:57:02 -0700 (PDT) From: Andi Vajda X-X-Sender: vajda@yuzu.local Reply-To: Andi Vajda To: pylucene-dev@lucene.apache.org Subject: Re: [jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (OSX 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-936094124-1571335023=:76832" --0-936094124-1571335023=:76832 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT Ah yes, I forgot about JArray. One sec. On Thu, 17 Oct 2019, Petrus Hyvönen (Jira) wrote: > > [ https://issues.apache.org/jira/browse/PYLUCENE-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16953958#comment-16953958 ] > > Petrus Hyvönen commented on PYLUCENE-51: > ---------------------------------------- > > Many Thanks for looking into this, most classes seems to have this property now but the JArray_* seems to use some other mechanism and do not have this? > >> "AttributeError: __module__" when running doctest >> ------------------------------------------------- >> >> Key: PYLUCENE-51 >> URL: https://issues.apache.org/jira/browse/PYLUCENE-51 >> Project: PyLucene >> Issue Type: Bug >> Environment: Ubuntu 19.04, Python 3.7 >> Reporter: Clément Jonglez >> Priority: Major >> >> Dear all, >> I am using the Orekit Python wrapper by [~petrush] . I am running into errors & warnings when trying to run tests with doctest. When collecting tests, it analyzes the classes (all the 1000+ wrapped Java classes it seems) and runs into the following error: >> {noformat} >> [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in collect >> for test in finder.find(module): >> [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in find >> extraglobs) >> [...]/lib/python3.7/doctest.py:932: in find >> self._find(tests, obj, name, module, source_lines, globs, {}) >> [...]/lib/python3.7/doctest.py:993: in _find >> self._from_module(module, val)): >> [...]/lib/python3.7/doctest.py:960: in _from_module >> return module._name_ == object._module_ >> E AttributeError: _module_{noformat} >> ??> In doctest ([https://github.com/python/cpython/blob/master/Lib/doctest.py#L959]), the >> {code:java} >> inspect.isclass(object) {code} >> condition at line 959 returns `True`, and therefore doctest tries to access the object's __module__ attribute, which does not seem to exist. >> Besides, pytest prints a warning for each Java class being wrapped, also because they have no __module__ attribute (this is one example of 1000+ warnings): >> {noformat} >> [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: builtin type ExtendedKalmanFilter has no __module_ attribute >> return f(*args, **kwds){noformat} >> This phenomenon is new because 6 months ago I could run pytest & doctest successfully with Orekit. I could not find which module contains the change that broke stuff since then though. >> To reproduce the phenomenon, you can check out [https://github.com/GorgiAstro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/test_propagation.py#L164] >> I was trying to validate some poliastro features using the Orekit python wrapper. So this code requires poliastro, it is available on conda-forge. >> Cheers >> Clément > > > > -- > This message was sent by Atlassian Jira > (v8.3.4#803005) > --0-936094124-1571335023=:76832--