From c45aea71df4f0d23892d6b11dcfe2c537015c864 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 29 Oct 2023 23:32:11 -0500 Subject: [PATCH] Fix tox tests for python3.6 --- tests/test_util.py | 11 +++++++++-- tox.ini | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/test_util.py b/tests/test_util.py index d424376..14de3a1 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,5 +1,6 @@ # -*- coding: utf-8; -*- +import sys from unittest import TestCase from unittest.mock import patch, MagicMock @@ -7,6 +8,8 @@ from unittest.mock import patch, MagicMock # behavior may ensue within some of the tests below import setuptools +import pytest + from wuttjamaican import util @@ -20,12 +23,16 @@ class TestLoadEntryPoints(TestCase): def test_basic(self): # load some entry points which should "always" be present, # even in a testing environment. basic sanity check - result = util.load_entry_points('console_scripts') + result = util.load_entry_points('console_scripts', ignore_errors=True) self.assertTrue(len(result) >= 1) self.assertIn('pip', result) def test_error(self): + # skip if < 3.8 + if sys.version_info.major == 3 and sys.version_info.minor < 8: + pytest.skip("this requires python 3.8 for entry points via importlib") + entry_point = MagicMock() entry_point.load.side_effect = NotImplementedError("just a testin") @@ -79,7 +86,7 @@ class TestLoadEntryPoints(TestCase): # load some entry points which should "always" be present, # even in a testing environment. basic sanity check - result = util.load_entry_points('console_scripts') + result = util.load_entry_points('console_scripts', ignore_errors=True) self.assertTrue(len(result) >= 1) self.assertIn('pip', result) diff --git a/tox.ini b/tox.ini index fe643fd..5efa949 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,11 @@ [tox] envlist = py36, py37, py38, py39, py310, py311 +# TODO: can remove this when we drop py36 support +# nb. need this for testing older python versions +# https://tox.wiki/en/latest/faq.html#testing-end-of-life-python-versions +requires = virtualenv<20.22.0 + [testenv] commands = pip install -U pip