Re: [Pyobjc-dev] doctest and PyObjC
Brought to you by:
ronaldoussoren
From: Ronald O. <ron...@ma...> - 2018-02-04 11:31:01
|
I’ve just pushed a fix to the repository. I’m hoping to push out a new release next weekend. There is no workaround for the issue other than patching PyObjC: In Lib/objc/_convenience.py remove the @register decorator from makeBundleForClass. I had hoped that there’d be a cleaner workaround, but that workaround caused a hard crash (also fixed in the repository). Ronald > On 28 Jan 2018, at 19:28, Ronald Oussoren <ron...@ma...> wrote: > > > >> On 6 Jan 2018, at 20:39, Just van Rossum <jus...@gm...> wrote: >> >> Hello, >> >> I’m having trouble with integrating PyObjC and doctest. Whenever a module contains an NSObject subclass, the doctest test discovery code fails like so: >> >> >> Traceback (most recent call last): >> File "Lib/typemachine/ui/appDelegate.py", line 54, in <module> >> doctest.testmod() >> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/doctest.py", line 1950, in testmod >> for test in finder.find(m, name, globs=globs, extraglobs=extraglobs): >> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/doctest.py", line 933, in find >> self._find(tests, obj, name, module, source_lines, globs, {}) >> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/doctest.py", line 996, in _find >> globs, seen) >> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/doctest.py", line 1027, in _find >> self._from_module(module, val)): >> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/doctest.py", line 954, in _from_module >> obj_mod = object.__objclass__.__module__ >> AttributeError: 'NoneType' object has no attribute ‘__module__' >> >> >> Simplest way to reproduce: >> >> ========= >> from Foundation import NSObject >> >> class Foo(NSObject): >> pass >> >> import doctest >> doctest.testmod() >> ========= >> >> I can’t judge whether this is a bug in doctest or in PyObjC. >> >> Is there a workaround? >> >> My problem is not so much that I can’t use doctest in NSObject subclasses, but rather that test discovery fails in general in the vicinity of PyObjC code. For example, I can’t use pytest’s test discovery at all: it simply fails any module that contains an NSObject subclass. >> >> Thanks for any insights, > > This appears to be a bug. I don’t have a workaround yet, but am investigating. > > Ronald > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |