Menu

#4 Python unit tests are broken when run with Python 3

1.53
closed
nobody
1.52 (1)
2024-01-05
2020-04-10
Micha Lenk
No

The Python unit tests are currently broken when run with Python 3. Trying to run them yields a syntax error:

8/8 Test #8: test-python ......................***Failed    0.01 sec
  File "/builds/aqbanking-team/pkg-ktoblzcheck/debian/output/libktoblzcheck-1.52/src/python/test_ktoblzcheck.py", line 18
    self.assertEqual(res.bankId, 20010020L)
                                         ^
SyntaxError: invalid syntax

Fixing that syntax error by just removing the 'L' from the long int reveals even more issues.

    Start 8: test-python
7/8 Test #8: test-python ......................***Failed    0.21 sec
.EEEEEF.
======================================================================
ERROR: test_findBank_fail (__main__.TestAccountNumberCheck)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/test_ktoblzcheck.py", line 23, in test_findBank_fail
    self.assertFalse(self.anc.findBank('20010033'))
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/ktoblzcheck.py", line 109, in findBank
    rec = kto.AccountNumberCheck_findBank(self, bankId)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type

======================================================================
ERROR: test_findBank_success (__main__.TestAccountNumberCheck)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/test_ktoblzcheck.py", line 15, in test_findBank_success
    res = self.anc.findBank('20010020')
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/ktoblzcheck.py", line 109, in findBank
    rec = kto.AccountNumberCheck_findBank(self, bankId)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type

======================================================================
ERROR: test_transmissionForm (__main__.TestIban)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/test_ktoblzcheck.py", line 30, in setUp
    self.iban1 = ktoblzcheck.Iban(s1)
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/ktoblzcheck.py", line 129, in __init__
    c_void_p.__init__(self, kto.Iban_new(iban, normalize))
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

======================================================================
ERROR: test_bic_position (__main__.TestIbanCheck)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/test_ktoblzcheck.py", line 68, in test_bic_position
    iban = ktoblzcheck.Iban("IBAN DE66 2007 0024 0929 1394 00")
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/ktoblzcheck.py", line 129, in __init__
    c_void_p.__init__(self, kto.Iban_new(iban, normalize))
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

======================================================================
ERROR: test_check (__main__.TestIbanCheck)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/test_ktoblzcheck.py", line 53, in test_check
    iban1 = ktoblzcheck.Iban(self.s)
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/ktoblzcheck.py", line 129, in __init__
    c_void_p.__init__(self, kto.Iban_new(iban, normalize))
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

======================================================================
FAIL: test_resultText (__main__.TestIbanCheck)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/micha/git/debian/ktoblzcheck/pkg.git/src/python/test_ktoblzcheck.py", line 63, in test_resultText
    self.assertEqual(rt, 'IBAN is ok')
AssertionError: b'IBAN is ok' != 'IBAN is ok'

----------------------------------------------------------------------
Ran 8 tests in 0.020s

FAILED (failures=1, errors=5)

Best regards,
Micha

Discussion

  • Ralf Habacker

    Ralf Habacker - 2020-04-20
    • labels: --> 1.53
    • status: open --> closed
     
  • Ralf Habacker

    Ralf Habacker - 2020-04-20

    Fixed with release 1.53

     
  • Ralf Habacker

    Ralf Habacker - 2024-01-05
    • labels: 1.53 --> 1.52
    • Version: 1.52 --> 1.53
     

Log in to post a comment.

MongoDB Logo MongoDB