~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Lib/distutils/tests/test_build_py.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
        open(os.path.join(testdir, "testfile"), "w").close()
70
70
 
71
71
        os.chdir(sources)
 
72
        old_stdout = sys.stdout
72
73
        sys.stdout = StringIO.StringIO()
73
74
 
74
75
        try:
87
88
        finally:
88
89
            # Restore state.
89
90
            os.chdir(cwd)
90
 
            sys.stdout = sys.__stdout__
 
91
            sys.stdout = old_stdout
 
92
 
 
93
    def test_dont_write_bytecode(self):
 
94
        # makes sure byte_compile is not used
 
95
        pkg_dir, dist = self.create_dist()
 
96
        cmd = build_py(dist)
 
97
        cmd.compile = 1
 
98
        cmd.optimize = 1
 
99
 
 
100
        old_dont_write_bytecode = sys.dont_write_bytecode
 
101
        sys.dont_write_bytecode = True
 
102
        try:
 
103
            cmd.byte_compile([])
 
104
        finally:
 
105
            sys.dont_write_bytecode = old_dont_write_bytecode
 
106
 
 
107
        self.assertTrue('byte-compiling is disabled' in self.logs[0][1])
91
108
 
92
109
def test_suite():
93
110
    return unittest.makeSuite(BuildPyTestCase)