Skip to content

Commit

Permalink
Tweak script tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsajip committed May 9, 2022
1 parent e714aa4 commit cf0ac74
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ Change log for ``distlib``

Released: Not yet.

- index

- Updated coverage pragmas for tests relating to obsolete PyPI APIs.

- locators

- Changed the default locator configuration.

- scripts

- Updated launcher executables. Thanks to Michael Bikovitsky for his help with
Expand All @@ -26,6 +34,8 @@ Released: Not yet.

- Fixed #169: Removed usage of deprecated imp module in favour of importlib.

In addition to the above, setup.py was replaced by setup.cfg and pyproject.toml.

0.3.4
~~~~~

Expand Down
13 changes: 6 additions & 7 deletions tests/test_scripts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 Vinay Sajip.
# Copyright (C) 2012-2022 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
Expand Down Expand Up @@ -37,7 +37,7 @@ class ScriptTestCase(DistlibTestCase):

def setUp(self):
source_dir = os.path.join(HERE, 'scripts')
target_dir = tempfile.mkdtemp()
target_dir = tempfile.mkdtemp(prefix='distlib-test-')
self.maker = ScriptMaker(source_dir, target_dir, add_launchers=False)

def tearDown(self):
Expand All @@ -60,9 +60,9 @@ def test_shebangs(self):
self.assertIn(executable, first_line)

def test_shebangs_custom_executable(self):
srcdir = tempfile.mkdtemp()
srcdir = tempfile.mkdtemp(prefix='distlib-test-')
self.addCleanup(shutil.rmtree, srcdir)
dstdir = tempfile.mkdtemp()
dstdir = tempfile.mkdtemp(prefix='distlib-test-')
self.addCleanup(shutil.rmtree, dstdir)
maker = ScriptMaker(srcdir, dstdir, add_launchers=False)
maker.executable = 'this_should_appear_in_the_shebang_line(中文)'
Expand Down Expand Up @@ -224,9 +224,9 @@ def test_launcher_run(self):

@unittest.skipIf(os.name != 'nt', 'Test is Windows-specific')
def test_launcher_run_with_interpreter_args(self):
srcdir = tempfile.mkdtemp()
srcdir = tempfile.mkdtemp(prefix='distlib-test-')
self.addCleanup(shutil.rmtree, srcdir)
dstdir = tempfile.mkdtemp()
dstdir = tempfile.mkdtemp(prefix='distlib-test-')
self.addCleanup(shutil.rmtree, dstdir)
maker = ScriptMaker(srcdir, dstdir, add_launchers=True)

Expand Down Expand Up @@ -435,6 +435,5 @@ def get_script_filenames(self, name):
expected = set([e.replace('.py', '.exe') for e in expected])
self.assertEqual(expected, set(files))


if __name__ == '__main__': # pragma: no cover
unittest.main()

0 comments on commit cf0ac74

Please sign in to comment.