mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
One unit test for distutils is not much, but is more than we had yesterday.
We need to write more; hopefully the barrier is a little lower now.
This commit is contained in:
parent
a050171ee9
commit
bb7c14461d
3 changed files with 98 additions and 0 deletions
46
Lib/distutils/tests/test_install_scripts.py
Normal file
46
Lib/distutils/tests/test_install_scripts.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
"""Tests for distutils.command.install_scripts."""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from distutils.command.install_scripts import install_scripts
|
||||
from distutils.core import Distribution
|
||||
|
||||
|
||||
class InstallScriptsTestCase(unittest.TestCase):
|
||||
|
||||
def test_default_settings(self):
|
||||
dist = Distribution()
|
||||
dist.command_obj["build"] = DummyCommand(build_scripts="/foo/bar")
|
||||
dist.command_obj["install"] = DummyCommand(
|
||||
install_scripts="/splat/funk",
|
||||
force=1,
|
||||
skip_build=1,
|
||||
)
|
||||
cmd = install_scripts(dist)
|
||||
self.assert_(not cmd.force)
|
||||
self.assert_(not cmd.skip_build)
|
||||
self.assert_(cmd.build_dir is None)
|
||||
self.assert_(cmd.install_dir is None)
|
||||
|
||||
cmd.finalize_options()
|
||||
|
||||
self.assert_(cmd.force)
|
||||
self.assert_(cmd.skip_build)
|
||||
self.assertEqual(cmd.build_dir, "/foo/bar")
|
||||
self.assertEqual(cmd.install_dir, "/splat/funk")
|
||||
|
||||
|
||||
class DummyCommand:
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
for kw, val in kwargs.items():
|
||||
setattr(self, kw, val)
|
||||
|
||||
def ensure_finalized(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def test_suite():
|
||||
return unittest.makeSuite(InstallScriptsTestCase)
|
Loading…
Add table
Add a link
Reference in a new issue