Repository: Ousret/pyTeliumManager (language: python)

Issue:
Test Case: test_tpe_autoget failes with: ValueError: Not a valid byte size: 1
```
$ ls -alh /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Mar 19 10:42 /dev/ttyACM0

$ python test_tpe_autoget.py 
EException AttributeError: "'NoneType' object has no attribute 'is_open'" in <bound method Telium.__del__ of <telium.manager.Telium instance at 0x7603f198>> ignored

======================================================================
ERROR: test_auto_get (__main__.TestTPEAutoGet)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_tpe_autoget.py", line 13, in test_auto_get
    my_telium_instance = Telium.get()
  File "/home/pi/.local/lib/python2.7/site-packages/telium/manager.py", line 87, in get
    return Telium(probables[0], baudrate, timeout, open_on_create, debugging)
  File "/home/pi/.local/lib/python2.7/site-packages/telium/manager.py", line 65, in __init__
    timeout=timeout
  File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 220, in __init__
    self.bytesize = bytesize
  File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 306, in bytesize
    raise ValueError("Not a valid byte size: {!r}".format(bytesize))
ValueError: Not a valid byte size: 1

----------------------------------------------------------------------
Ran 1 test in 0.008s

FAILED (errors=1)
```
System Information:
```
$ python --version
Python 2.7.16

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

$ git log | head
commit d587d8edd713d929e0323d2a92546b5c60c2d52b
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.

commit 10c833df887af79b889a1ae58e68a7567de3632f
Author: TAHRI Ahmed R <nyuubi.10@gmail.com>
```



Discussion / hints:
This is also present for python3
```

$ python3 test_tpe_autoget.py 
EException ignored in: <function Telium.__del__ at 0x75eff2b8>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pyTeliumManager-2.4.1-py3.7.egg/telium/manager.py", line 91, in __del__
AttributeError: 'NoneType' object has no attribute 'is_open'

======================================================================
ERROR: test_auto_get (__main__.TestTPEAutoGet)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_tpe_autoget.py", line 13, in test_auto_get
    my_telium_instance = Telium.get()
  File "/usr/local/lib/python3.7/dist-packages/pyTeliumManager-2.4.1-py3.7.egg/telium/manager.py", line 87, in get
    return Telium(probables[0], baudrate, timeout, open_on_create, debugging)
  File "/usr/local/lib/python3.7/dist-packages/pyTeliumManager-2.4.1-py3.7.egg/telium/manager.py", line 65, in __init__
    timeout=timeout
  File "/home/pi/.local/lib/python3.7/site-packages/serial/serialutil.py", line 220, in __init__
    self.bytesize = bytesize
  File "/home/pi/.local/lib/python3.7/site-packages/serial/serialutil.py", line 306, in bytesize
    raise ValueError("Not a valid byte size: {!r}".format(bytesize))
ValueError: Not a valid byte size: 1

----------------------------------------------------------------------
Ran 1 test in 0.011s

FAILED (errors=1)
```

Fix patch:
diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml
new file mode 100644
index 0000000..1a03a7b
--- /dev/null
+++ b/.github/workflows/python-publish.yml
@@ -0,0 +1,31 @@
+# This workflow will upload a Python Package using Twine when a release is created
+# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
+
+name: Upload Python Package
+
+on:
+  release:
+    types: [created]
+
+jobs:
+  deploy:
+
+    runs-on: ubuntu-latest
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python
+      uses: actions/setup-python@v2
+      with:
+        python-version: '3.x'
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        pip install setuptools wheel twine
+    - name: Build and publish
+      env:
+        TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
+        TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+      run: |
+        python setup.py sdist bdist_wheel
+        twine upload dist/*
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 4f65f7c..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-language: python
-python:
-  - "2.7"
-  - "3.4"
-  - "3.6"
-  - "3.7"
-  - "3.8"
-
-matrix:
-  allow_failures:
-    - python: "2.7"
-
-install:
-  - pip install nose Faker codecov
-  - python setup.py install
-
-script:
-  - "nosetests --with-coverage --cover-package=telium test/*.py"
-
-after_success:
-  - codecov
\ No newline at end of file
diff --git a/dev-requirements.txt b/dev-requirements.txt
new file mode 100644
index 0000000..1a7710b
--- /dev/null
+++ b/dev-requirements.txt
@@ -0,0 +1,4 @@
+Faker
+pytest
+pytest-cov
+codecov
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..952c8c0
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,5 @@
+[tool:pytest]
+addopts = --cov=telium --cov-report=term-missing -rxXs
+
+[bdist_wheel]
+universal=1
diff --git a/setup.py b/setup.py
index 7dd4dd1..6dc1ab0 100644
--- a/setup.py
+++ b/setup.py
@@ -34,9 +34,13 @@ def get_version():
     packages=['telium'],
     test_suite='test',
     url='https://github.com/Ousret/pyTeliumManager',
-    download_url='https://github.com/Ousret/pyTeliumManager/archive/2.4.1.tar.gz',
-    install_requires=['pyserial>=3.3', 'pycountry>=17.0', 'payment_card_identifier>=0.1.2', 'six'],
-    tests_require=['Faker'],
+    install_requires=[
+        'pyserial>=3.3',
+        'pycountry>=17.0,<18.5.20',
+        'payment_card_identifier>=0.1.2',
+        'six'
+    ],
+    tests_require=['Faker', 'pytest'],
     keywords=['ingenico', 'telium manager', 'telium', 'payment', 'credit card', 'debit card', 'visa', 'mastercard',
               'merchant', 'pos'],
     classifiers=[
@@ -57,6 +61,8 @@ def get_version():
         'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
-        'Programming Language :: Python :: 3.8'
+        'Programming Language :: Python :: 3.8',
+        'Programming Language :: Python :: 3.9',
+        'Programming Language :: Python :: 3.10',
     ]
 )
diff --git a/telium/version.py b/telium/version.py
index 7d89ff0..6d12c6f 100644
--- a/telium/version.py
+++ b/telium/version.py
@@ -2,5 +2,5 @@
 Expose version
 """
 
-__version__ = "2.4.1"
+__version__ = "2.4.2"
 VERSION = __version__.split('.')


Test patch:
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
new file mode 100644
index 0000000..ea84f30
--- /dev/null
+++ b/.github/workflows/run-tests.yml
@@ -0,0 +1,31 @@
+name: Tests
+
+on: [push, pull_request]
+
+jobs:
+  tests:
+    runs-on: ${{ matrix.os }}
+
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, "3.10.0-rc.1"]
+        os: [ubuntu-latest]
+
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v2
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: |
+        pip install -U pip setuptools
+        pip install -r dev-requirements.txt
+    - name: Install the package
+      run: |
+        python setup.py install
+    - name: Run tests
+      run: |
+        pytest
+    - uses: codecov/codecov-action@v1
diff --git a/test/__init__.py b/test/__init__.py
new file mode 100644
index 0000000..e69de29