Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1000)

Unified Diff: tests/super_mox.py

Issue 562031: Fix licensing headers and move most third party code to third_party/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/super_mox.py
===================================================================
--- tests/super_mox.py (revision 37929)
+++ tests/super_mox.py (working copy)
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -8,12 +8,15 @@
import __builtin__
import os
import random
+import shutil
import string
import subprocess
import sys
-from pymox import mox
+sys.path.append(os.path.dirname(os.path.dirname(__file__)))
+from third_party.pymox import mox
+
class IsOneOf(mox.Comparator):
def __init__(self, keys):
self._keys = keys
@@ -96,6 +99,7 @@
os_path_to_mock = ('abspath', 'exists', 'getsize', 'isdir', 'isfile',
'islink', 'ismount', 'lexists', 'realpath', 'samefile', 'walk')
self.MockList(os.path, os_path_to_mock)
+ self.MockList(shutil, ('rmtree'))
self.MockList(subprocess, ('call', 'Popen'))
# Don't mock stderr since it confuses unittests.
self.MockList(sys, ('stdin', 'stdout'))
@@ -105,4 +109,7 @@
# Skip over items not present because of OS-specific implementation,
# implemented only in later python version, etc.
if hasattr(parent, item):
- self.mox.StubOutWithMock(parent, item)
+ try:
+ self.mox.StubOutWithMock(parent, item)
+ except TypeError:
+ raise TypeError('Couldn\'t mock %s in %s' % (item, parent.__name__))

Powered by Google App Engine
This is Rietveld 408576698