Skip to content

Commit

Permalink
change distutils import order
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Dec 17, 2020
1 parent 63f56a6 commit 439e45a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
python-version: [3.6, 3.7, 3.8]
astropy-version: ['==4.0.1.post1', '<4.1', '<5.0']

env:
SETUPTOOLS_USE_DISTUTILS: stdlib

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
9 changes: 6 additions & 3 deletions py/desiutil/test/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import unittest
from unittest.mock import call, patch
from tempfile import mkdtemp
from distutils import log
from packaging import version
from setuptools import __version__ as setuptools_version
from setuptools import sandbox
from distutils import log
from ..setup import find_version_directory, get_version, update_version
from .. import __version__ as desiutil_version

Expand All @@ -26,6 +28,7 @@ def setUpClass(cls):
if hasattr(sandbox, 'hide_setuptools'):
sandbox.hide_setuptools = lambda: None
cls.old_threshold = log.set_threshold(log.WARN)
cls.distutils_log = 'distutils.log.Log._log'

@classmethod
def tearDownClass(cls):
Expand Down Expand Up @@ -85,13 +88,13 @@ def test_version(self):
i.write(init)
os.chdir(package_dir)
v_file = os.path.join(package_dir, self.fake_name, '_version.py')
with patch('distutils.log.Log._log') as mock_log:
with patch(self.distutils_log) as mock_log:
self.run_setup('setup.py', ['version'])
self.assertTrue(os.path.exists(v_file))
self.assertListEqual(mock_log.mock_calls,
[call(2, 'running %s', ('version',)),
call(2, 'Version is now 0.0.1.dev0.', ())])
with patch('distutils.log.Log._log') as mock_log:
with patch(self.distutils_log) as mock_log:
self.run_setup('setup.py', ['version', '--tag', '1.2.3'])
with open(v_file) as v:
data = v.read()
Expand Down

0 comments on commit 439e45a

Please sign in to comment.