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

Side by Side Diff: lib/naclports/tests/test_installed_package.py

Issue 1285953002: Switch devenv to use pkg packages (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@toolchain_install
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « lib/naclports/source_package.py ('k') | ports/avrdude/build.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Native Client Authors. All rights reserved. 1 # Copyright 2014 The Native Client Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from mock import call, patch, Mock 5 from mock import call, patch, Mock
6 6
7 import common 7 import common
8 from naclports import package 8 from naclports import package
9 9
10 test_info = '''\ 10 test_info = '''\
(...skipping 11 matching lines...) Expand all
22 file_mock = common.MockFileObject(test_info) 22 file_mock = common.MockFileObject(test_info)
23 with patch('__builtin__.open', Mock(return_value=file_mock), create=True): 23 with patch('__builtin__.open', Mock(return_value=file_mock), create=True):
24 return package.InstalledPackage('dummy_file') 24 return package.InstalledPackage('dummy_file')
25 25
26 26
27 class TestInstalledPackage(common.NaclportsTest): 27 class TestInstalledPackage(common.NaclportsTest):
28 28
29 @patch('naclports.package.Log', Mock()) 29 @patch('naclports.package.Log', Mock())
30 @patch('naclports.package.RemoveFile') 30 @patch('naclports.package.RemoveFile')
31 @patch('os.path.lexists', Mock(return_value=True)) 31 @patch('os.path.lexists', Mock(return_value=True))
32 @patch('os.path.exists', Mock(return_value=True))
32 def testUninstall(self, remove_patch): # pylint: disable=no-self-use 33 def testUninstall(self, remove_patch): # pylint: disable=no-self-use
33 pkg = CreateMockInstalledPackage() 34 pkg = CreateMockInstalledPackage()
34 pkg.Files = Mock(return_value=['f1', 'f2']) 35 pkg.Files = Mock(return_value=['f1', 'f2'])
35 pkg.Uninstall() 36 pkg.Uninstall()
36 37
37 # Assert that exactly 4 files we removed using RemoveFile 38 # Assert that exactly 4 files we removed using RemoveFile
38 calls = [call('/package/install/path/var/lib/npkg/foo.info'), 39 calls = [call('/package/install/path/var/lib/npkg/foo.info'),
39 call('/package/install/path/f1'), 40 call('/package/install/path/f1'),
40 call('/package/install/path/f2'), 41 call('/package/install/path/f2'),
41 call('/package/install/path/var/lib/npkg/foo.list')] 42 call('/package/install/path/var/lib/npkg/foo.list')]
42 remove_patch.assert_has_calls(calls) 43 remove_patch.assert_has_calls(calls)
OLDNEW
« no previous file with comments | « lib/naclports/source_package.py ('k') | ports/avrdude/build.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698