From pylucene-dev-return-3067-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Fri Oct 11 01:11:02 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 44320180626 for ; Fri, 11 Oct 2019 03:11:02 +0200 (CEST) Received: (qmail 62767 invoked by uid 500); 11 Oct 2019 01:11:01 -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 62756 invoked by uid 99); 11 Oct 2019 01:11:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Oct 2019 01:11:01 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id AF451E2DEA for ; Fri, 11 Oct 2019 01:11:00 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 077E278074B for ; Fri, 11 Oct 2019 01:11:00 +0000 (UTC) Date: Fri, 11 Oct 2019 01:11:00 +0000 (UTC) From: "Andreas Vajda (Jira)" To: pylucene-dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PYLUCENE-51) "AttributeError: __module__" when running doctest MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PYLUCENE-51?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D169= 49036#comment-16949036 ]=20 Andreas Vajda commented on PYLUCENE-51: --------------------------------------- This site is about bugs in PyLucene and JCC not Orekit. Please, contact Petrus directly about Orekit issues. JCC does not, did not, set __module__ on anything ever. JCC did set module.__dir__ in the past until Python 3 grabbed __dir__ in PE= P 562. It now sets module.__module_dir__ in Python 3. In Python 2, it still sets module.__dir__. > "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=C3=A9ment Jonglez > Priority: Major > > Dear all, > I am using the Orekit Python wrapper by [~petrush] . I am running into er= rors & warnings when trying to run tests with doctest. When collecting test= s, it analyzes the classes (all the 1000+ wrapped Java classes it seems) an= d runs into the following error: > {noformat} > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:137: in co= llect > for test in finder.find(module): > [...]/lib/python3.7/site-packages/pytest_doctestplus/plugin.py:425: in f= ind > 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_ =3D=3D object._module_ > E AttributeError: _module_{noformat} > =C2=A0 > 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 acce= ss 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+ war= nings): > {noformat} > [...]/lib/python3.7/importlib/bootstrap.py:219: DeprecationWarning: built= in 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/GorgiA= stro/poliastro/blob/orekit-validation/src/poliastro/tests/tests_twobody/tes= t_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=C3=A9ment -- This message was sent by Atlassian Jira (v8.3.4#803005)