Exemple #1
0
	def test_should_load_saved_dependency_information(self):
		picklefile = mock('pickle file')
		mock_on(builtin).open.is_expected.\
			with_(pickle_path).\
			returning(picklefile.raw)
		pickle = mock('unpickled info')
		mock_on(scanner.pickle).load.is_expected.with_(picklefile.raw).returning(pickle.raw)
		
		loaded = scanner.load()
		self.assertEqual(loaded, pickle.raw)
Exemple #2
0
	def test_should_load_saved_dependency_information(self):
		picklefile = mock('pickle file')
		expect(scanner).open_file(pickle_path).and_return(picklefile)
		pickle = mock('unpickled info')
		expect(scanner.pickle).load(picklefile).and_return(pickle)

		manager = mock('manager')
		expect(scanner.FileSystemStateManager)['__new__'](any_(type), pickle).and_return(manager)
		
		loaded = scanner.load()
		self.assertEqual(loaded, manager)
    def test_should_load_saved_dependency_information(self):
        picklefile = mock('pickle file')
        mock_on(scanner).open_file.is_expected.\
         with_(pickle_path).\
         returning(picklefile.raw)
        pickle = mock('unpickled info')
        mock_on(scanner.pickle).load.is_expected.with_(
            picklefile.raw).returning(pickle.raw)

        loaded = scanner.load()
        self.assertEqual(loaded, pickle.raw)
Exemple #4
0
	def test_should_return_an_empty_dict_when_no_pickle_exists(self):
		expect(scanner).open_file.and_raise(IOError())
		state = mock('state')
		manager = mock('manager')
		expect(scanner.FileSystemState)['__new__'].and_return(state)
		expect(scanner.FileSystemStateManager)['__new__'].and_return(manager)
		expect(scanner.pickle).load.never()
		expect(manager).update
		modify(sys).stderr = mock('stderr')
		expect(sys.stderr).write.never()
		
		self.assertEqual(scanner.load(), manager)
Exemple #5
0
	def test_should_return_an_empty_dict_when_no_pickle_exists(self):
		mock_on(builtin).open.is_expected.raising(IOError())
		mock_on(scanner.pickle).load.is_not_expected
		mock_on(sys).stderr.is_not_expected
		
		self.assertEqual(scanner.load(), {})
    def test_should_return_an_empty_dict_when_no_pickle_exists(self):
        mock_on(scanner).open_file.is_expected.raising(IOError())
        mock_on(scanner.pickle).load.is_not_expected
        mock_on(sys).stderr.is_not_expected

        self.assertEqual(scanner.load(), {})