Ousret / pyTeliumManager

Python library to manipulate Ingenico mobile payment device like iCT220 or iWL220 equipped with Telium Manager. RS232/USB.
http://pyteliummanager.readthedocs.io
MIT License
103 stars 20 forks source link

Test Case: test_payment is Failing with: TypeError: a new-style class can't have only classic bases #20

Closed JeanCarlosChavarriaHughes closed 3 years ago

JeanCarlosChavarriaHughes commented 3 years ago

The test case test_payment.py is failing with the error: TypeError: a new-style class can't have only classic bases

$ python test_payment.py 
{
    "_amount": 12.5, 
    "_card_type": null, 
    "_currency_numeric": "978", 
    "_payment_mode": "0", 
    "_pos_number": "01", 
    "_private": "0000000000", 
    "_repport": "0000000000000000000000000000000000000000000000000000000", 
    "_transaction_result": 0, 
    "has_succeeded": true, 
    "transaction_id": "0000000000"
}
.E......
======================================================================
ERROR: test_telium_ask_currencies_setter (__main__.TestTPE)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_payment.py", line 68, in test_telium_ask_currencies_setter
    my_payment.currency_numeric = 'EUR'
  File "/home/pi/.local/lib/python2.7/site-packages/telium/payment.py", line 97, in currency_numeric
    currency = currencies.get(alpha_3=currency.upper())
  File "/home/pi/.local/lib/python2.7/site-packages/pycountry/db.py", line 40, in load_if_needed
    self._load()
  File "/home/pi/.local/lib/python2.7/site-packages/pycountry/db.py", line 67, in _load
    self.data_class_name, (self.data_class_base,), {})
TypeError: a new-style class can't have only classic bases

----------------------------------------------------------------------
Ran 8 tests in 0.058s

FAILED (errors=1)

Version of the project:

commit d587d8edd713d929e0323d2a92546b5c60c2d52b (HEAD -> master, origin/master, origin/HEAD)
Author: TAHRI Ahmed R <Ousret@users.noreply.github.com>
Date:   Fri Feb 28 22:54:48 2020 +0100

    Improve setup.py and expose version in package (#13)

    Some python version were missing and the description was not included on PyPi. And fix minors issues.

$ python --version
Python 2.7.16
JeanCarlosChavarriaHughes commented 3 years ago

This Bug is only present in Python2. For python3 it works as expected

darnti commented 3 years ago

Having this same issue. The same code works fine on a windows installation of Python 2.7, and fails on an Ubuntu installation. I temporarily worked around it by rolling back to pycountry version 18.5.20.