Skip to content

Python3.12: two tests fail #218

@penguinpee

Description

@penguinpee

I just applied c00b217 for making the package Python3.12 compatible in Fedora.

Now I have two tests failing with TypeError: 'float' object cannot be interpreted as an integer:

======================================================================
ERROR: test_testsuite (sciunit.unit_test.test_tests.TestSuitesTestCase.test_testsuite)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/sciunit-c70f3886f49ebd71bfc8d33c9821f2e40341f3ce/sciunit/unit_test/test_tests.py", line 111, in test_testsuite
    t = TestSuite([t1, t2])
        ^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/sciunit-c70f3886f49ebd71bfc8d33c9821f2e40341f3ce/sciunit/suites.py", line 43, in __init__
    self.name = name if name else "Suite_%d" % random.randint(0, 1e12)
                                               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/random.py", line 336, in randint
    return self.randrange(a, b+1)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/random.py", line 312, in randrange
    istop = _index(stop)
            ^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer

======================================================================
ERROR: test_testsuite_set_verbose (sciunit.unit_test.test_tests.TestSuitesTestCase.test_testsuite_set_verbose)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/sciunit-c70f3886f49ebd71bfc8d33c9821f2e40341f3ce/sciunit/unit_test/test_tests.py", line 160, in test_testsuite_set_verbose
    t = TestSuite([t1, t2])
        ^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/sciunit-c70f3886f49ebd71bfc8d33c9821f2e40341f3ce/sciunit/suites.py", line 43, in __init__
    self.name = name if name else "Suite_%d" % random.randint(0, 1e12)
                                               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/random.py", line 336, in randint
    return self.randrange(a, b+1)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/random.py", line 312, in randrange
    istop = _index(stop)
            ^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer

----------------------------------------------------------------------
Ran 83 tests in 21.478s

FAILED (errors=2, skipped=5)

I believe this is related to Python3.12 changes, but it's beyond me to investigate further, atm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions