1
0
Fork 0

Fix tox tests for python3.6

This commit is contained in:
Lance Edgar 2023-10-29 23:32:11 -05:00
parent cd2d16e6ac
commit c45aea71df
2 changed files with 14 additions and 2 deletions

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8; -*- # -*- coding: utf-8; -*-
import sys
from unittest import TestCase from unittest import TestCase
from unittest.mock import patch, MagicMock 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 # behavior may ensue within some of the tests below
import setuptools import setuptools
import pytest
from wuttjamaican import util from wuttjamaican import util
@ -20,12 +23,16 @@ class TestLoadEntryPoints(TestCase):
def test_basic(self): def test_basic(self):
# load some entry points which should "always" be present, # load some entry points which should "always" be present,
# even in a testing environment. basic sanity check # 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.assertTrue(len(result) >= 1)
self.assertIn('pip', result) self.assertIn('pip', result)
def test_error(self): 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 = MagicMock()
entry_point.load.side_effect = NotImplementedError("just a testin") 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, # load some entry points which should "always" be present,
# even in a testing environment. basic sanity check # 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.assertTrue(len(result) >= 1)
self.assertIn('pip', result) self.assertIn('pip', result)

View file

@ -2,6 +2,11 @@
[tox] [tox]
envlist = py36, py37, py38, py39, py310, py311 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] [testenv]
commands = commands =
pip install -U pip pip install -U pip