Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.9: AttributeError: 'Thread' object has no attribute 'isAlive' #75

Closed
hroncok opened this issue Jan 4, 2020 · 2 comments
Closed

Comments

@hroncok
Copy link
Contributor

hroncok commented Jan 4, 2020

Hello, we are already testing packages in Fedora with Python 3.9.0a2. The tests of decorator fail with:

+ /usr/bin/python3 setup.py test
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
writing src/decorator.egg-info/PKG-INFO
writing dependency_links to src/decorator.egg-info/dependency_links.txt
writing top-level names to src/decorator.egg-info/top_level.txt
reading manifest file 'src/decorator.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'README.rst'
warning: no files found matching 'documentation.pdf'
writing manifest file 'src/decorator.egg-info/SOURCES.txt'
running build_ext
test_before_after (tests.test.CoroutineTestCase) ... ok
test_coro_to_func (tests.test.CoroutineTestCase) ... ok
test (tests.test.DocumentationTestCase) ... **********************************************************************
File "/builddir/build/BUILD/decorator-4.4.0/src/tests/documentation.py", line 531, in tests.documentation
Failed example:
    print(read_data())  # data is not available yet
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.9/doctest.py", line 1329, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest tests.documentation[33]>", line 1, in <module>
        print(read_data())  # data is not available yet
      File "</builddir/build/BUILD/decorator-4.4.0/src/decorator.py:decorator-gen-26>", line 2, in read_data
      File "/builddir/build/BUILD/decorator-4.4.0/src/tests/documentation.py", line 1532, in blocking
        elif f.thread.isAlive():
    AttributeError: 'Thread' object has no attribute 'isAlive'
**********************************************************************
File "/builddir/build/BUILD/decorator-4.4.0/src/tests/documentation.py", line 535, in tests.documentation
Failed example:
    print(read_data())  # data is not available yet
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.9/doctest.py", line 1329, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest tests.documentation[35]>", line 1, in <module>
        print(read_data())  # data is not available yet
      File "</builddir/build/BUILD/decorator-4.4.0/src/decorator.py:decorator-gen-26>", line 2, in read_data
      File "/builddir/build/BUILD/decorator-4.4.0/src/tests/documentation.py", line 1532, in blocking
        elif f.thread.isAlive():
    AttributeError: 'Thread' object has no attribute 'isAlive'
**********************************************************************
File "/builddir/build/BUILD/decorator-4.4.0/src/tests/documentation.py", line 539, in tests.documentation
Failed example:
    print(read_data())
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib64/python3.9/doctest.py", line 1329, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest tests.documentation[37]>", line 1, in <module>
        print(read_data())
      File "</builddir/build/BUILD/decorator-4.4.0/src/decorator.py:decorator-gen-26>", line 2, in read_data
      File "/builddir/build/BUILD/decorator-4.4.0/src/tests/documentation.py", line 1532, in blocking
        elif f.thread.isAlive():
    AttributeError: 'Thread' object has no attribute 'isAlive'
**********************************************************************
1 items had failures:
   3 of  88 in tests.documentation
***Test Failed*** 3 failures.
FAIL
test_singledispatch1 (tests.test.DocumentationTestCase) ... ok
test_singledispatch2 (tests.test.DocumentationTestCase) ... ok
test_add1 (tests.test.ExtraTestCase) ... ok
test_decorator_factory (tests.test.ExtraTestCase) ... ok
test_no_first_arg (tests.test.ExtraTestCase) ... ok
test_qualname (tests.test.ExtraTestCase) ... ok
test_signature (tests.test.ExtraTestCase) ... ok
test_unique_filenames (tests.test.ExtraTestCase) ... ok
test_gen123 (tests.test.GeneratorCallerTestCase) ... ok
test_c_classes (tests.test.TestSingleDispatch) ... ok
test_mro (tests.test.TestSingleDispatch) ... ok
test_mro_conflicts (tests.test.TestSingleDispatch) ... ok
test_register_abc (tests.test.TestSingleDispatch) ... ok
test_register_decorator (tests.test.TestSingleDispatch) ... ok
test_register_error (tests.test.TestSingleDispatch) ... ok
test_simple_overloads (tests.test.TestSingleDispatch) ... ok
test_wrapping_attributes (tests.test.TestSingleDispatch) ... ok

======================================================================
FAIL: test (tests.test.DocumentationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/decorator-4.4.0/src/tests/test.py", line 81, in test
    self.assertEqual(err, 0)
AssertionError: 3 != 0

----------------------------------------------------------------------
Ran 20 tests in 5.660s

FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=20 errors=0 failures=1>

Indeed, isAlive() is deprecated, use is_alive() instead:

$ python3.8 -c 'import threading; t = threading.Thread(); t.isAlive()'
<string>:1: DeprecationWarning: isAlive() is deprecated, use is_alive() instead
$ python3.9 -c 'import threading; t = threading.Thread(); t.isAlive()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'Thread' object has no attribute 'isAlive'

Will submit a PR.

@hroncok
Copy link
Contributor Author

hroncok commented Jan 4, 2020

There are more:

+ /usr/bin/python3 setup.py test
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
writing src/decorator.egg-info/PKG-INFO
writing dependency_links to src/decorator.egg-info/dependency_links.txt
writing top-level names to src/decorator.egg-info/top_level.txt
reading manifest file 'src/decorator.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'README.rst'
warning: no files found matching 'documentation.pdf'
writing manifest file 'src/decorator.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "/builddir/build/BUILD/decorator-4.4.0/setup.py", line 9, in <module>
    setup(name='decorator',
  File "/usr/lib/python3.9/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.9/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib64/python3.9/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.9/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.9/site-packages/setuptools/command/test.py", line 237, in run
    self.run_tests()
  File "/usr/lib/python3.9/site-packages/setuptools/command/test.py", line 255, in run_tests
    test = unittest.main(
  File "/usr/lib64/python3.9/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File "/usr/lib64/python3.9/unittest/main.py", line 147, in parseArgs
    self.createTests()
  File "/usr/lib64/python3.9/unittest/main.py", line 158, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
  File "/usr/lib64/python3.9/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib64/python3.9/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib64/python3.9/unittest/loader.py", line 191, in loadTestsFromName
    return self.loadTestsFromModule(obj)
  File "/usr/lib/python3.9/site-packages/setuptools/command/test.py", line 55, in loadTestsFromModule
    tests.append(self.loadTestsFromName(submodule))
  File "/usr/lib64/python3.9/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builddir/build/BUILD/decorator-4.4.0/src/tests/documentation.py", line 1785, in <module>
    class SomeSet(collections.Sized):
AttributeError: module 'collections' has no attribute 'Sized'

hroncok added a commit to hroncok/decorator that referenced this issue Jan 4, 2020
@hroncok
Copy link
Contributor Author

hroncok commented Jan 4, 2020

#76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant