Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(15876)

Side by Side Diff: Lib/distutils/tests/test_install_scripts.py

Issue 19600: Use specific asserts in distutils tests
Patch Set: Created 5 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 """Tests for distutils.command.install_scripts.""" 1 """Tests for distutils.command.install_scripts."""
2 2
3 import os 3 import os
4 import unittest 4 import unittest
5 5
6 from distutils.command.install_scripts import install_scripts 6 from distutils.command.install_scripts import install_scripts
7 from distutils.core import Distribution 7 from distutils.core import Distribution
8 8
9 from distutils.tests import support 9 from distutils.tests import support
10 from test.support import run_unittest 10 from test.support import run_unittest
11 11
12 12
13 class InstallScriptsTestCase(support.TempdirManager, 13 class InstallScriptsTestCase(support.TempdirManager,
14 support.LoggingSilencer, 14 support.LoggingSilencer,
15 unittest.TestCase): 15 unittest.TestCase):
16 16
17 def test_default_settings(self): 17 def test_default_settings(self):
18 dist = Distribution() 18 dist = Distribution()
19 dist.command_obj["build"] = support.DummyCommand( 19 dist.command_obj["build"] = support.DummyCommand(
20 build_scripts="/foo/bar") 20 build_scripts="/foo/bar")
21 dist.command_obj["install"] = support.DummyCommand( 21 dist.command_obj["install"] = support.DummyCommand(
22 install_scripts="/splat/funk", 22 install_scripts="/splat/funk",
23 force=1, 23 force=1,
24 skip_build=1, 24 skip_build=1,
25 ) 25 )
26 cmd = install_scripts(dist) 26 cmd = install_scripts(dist)
27 self.assertTrue(not cmd.force) 27 self.assertFalse(cmd.force)
28 self.assertTrue(not cmd.skip_build) 28 self.assertFalse(cmd.skip_build)
29 self.assertTrue(cmd.build_dir is None) 29 self.assertIsNone(cmd.build_dir)
30 self.assertTrue(cmd.install_dir is None) 30 self.assertIsNone(cmd.install_dir)
31 31
32 cmd.finalize_options() 32 cmd.finalize_options()
33 33
34 self.assertTrue(cmd.force) 34 self.assertTrue(cmd.force)
35 self.assertTrue(cmd.skip_build) 35 self.assertTrue(cmd.skip_build)
36 self.assertEqual(cmd.build_dir, "/foo/bar") 36 self.assertEqual(cmd.build_dir, "/foo/bar")
37 self.assertEqual(cmd.install_dir, "/splat/funk") 37 self.assertEqual(cmd.install_dir, "/splat/funk")
38 38
39 def test_installation(self): 39 def test_installation(self):
40 source = self.mkdtemp() 40 source = self.mkdtemp()
(...skipping 24 matching lines...) Expand all
65 install_scripts=target, 65 install_scripts=target,
66 force=1, 66 force=1,
67 skip_build=1, 67 skip_build=1,
68 ) 68 )
69 cmd = install_scripts(dist) 69 cmd = install_scripts(dist)
70 cmd.finalize_options() 70 cmd.finalize_options()
71 cmd.run() 71 cmd.run()
72 72
73 installed = os.listdir(target) 73 installed = os.listdir(target)
74 for name in expected: 74 for name in expected:
75 self.assertTrue(name in installed) 75 self.assertIn(name, installed)
76 76
77 77
78 def test_suite(): 78 def test_suite():
79 return unittest.makeSuite(InstallScriptsTestCase) 79 return unittest.makeSuite(InstallScriptsTestCase)
80 80
81 if __name__ == "__main__": 81 if __name__ == "__main__":
82 run_unittest(test_suite()) 82 run_unittest(test_suite())
OLDNEW

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+