From cc3c6c7128e08bccbac221f7103e7ff073755911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@ericsson.com> Date: Mon, 2 Sep 2024 18:07:31 +0200 Subject: [PATCH] add unit tests for Python 2.7 --- .gitlab-ci.yml | 4 ++-- setup.py | 2 +- tests/test_framing.py | 5 ++--- tests/test_objects.py | 5 ++--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2a77fad..dd811a4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ stages: alias: rabbitmq before_script: - python setup.py install - - pip install --break-system-packages nose2 coverage requests yapf + - pip install --break-system-packages nose2 coverage requests yapf unittest2 - coverage run --append -m compile_definitions artifacts: paths: @@ -56,7 +56,7 @@ unittest_epoll_python27: extends: .before_test image: python:2.7 before_script: - - pip install nose2 coverage + - pip install nose2 coverage unittest2 - python setup.py install script: - coverage run --append -m nose2 -F -vv diff --git a/setup.py b/setup.py index 00144ae..bb97edd 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup(keywords=['amqp', 'rabbitmq', 'client', 'network', 'ha', 'high availabilit version=__version__, packages=find_packages(include=['coolamqp', 'coolamqp.*']), install_requires=['six'], - tests_require=["pytest", "coverage"], + tests_require=["pytest", "coverage", "unittest2"], test_suite='nose2.collector.collector', python_requires='!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*', extras_require={ diff --git a/tests/test_framing.py b/tests/test_framing.py index 3cffff0..3b4c10b 100644 --- a/tests/test_framing.py +++ b/tests/test_framing.py @@ -7,8 +7,7 @@ from coolamqp.objects import argumentify class TestFraming(unittest.TestCase): - def test_something(self): + def test_enframing_arguments(self): buf = io.BytesIO() args = argumentify({'x-match': 'all', 'format': 'pdf'}) - res = enframe_table(buf, args) - print(repr(res)) + enframe_table(buf, args) diff --git a/tests/test_objects.py b/tests/test_objects.py index fbd7c76..ee1c7cb 100644 --- a/tests/test_objects.py +++ b/tests/test_objects.py @@ -1,19 +1,18 @@ # coding=UTF-8 from __future__ import print_function, absolute_import, division -import unittest +import unittest2 import sys from coolamqp.objects import NodeDefinition, MessageProperties, Queue -class TestObjects(unittest.TestCase): +class TestObjects(unittest2.TestCase): def test_message_properties(self): empty_p_msg = MessageProperties() ce_p_msg = MessageProperties(content_encoding=b'wtf') self.assertIn('wtf', str(ce_p_msg)) - @unittest.skipIf(sys.platform.startswith('2'), 'Only Python 3 has assertWarns') def test_warning(self): with self.assertWarns(PendingDeprecationWarning): Queue(auto_delete=True, exclusive=False) -- GitLab