Esempio n. 1
0
def test_subprocess_manager_invalid_when_exe_missing():
    """
	If the hg executable dosen't exist, the manager should report
	False for .is_valid().
	"""
    non_existent_exe = '/non_existent_executable'
    assert not os.path.exists(non_existent_exe)
    mgr = managers.SubprocessManager()
    mgr.exe = non_existent_exe
    assert not mgr.is_valid()
Esempio n. 2
0
def test_repo():
    with tempdir_context():
        mgr = managers.SubprocessManager()
        mgr._run_hg('init', 'foo')
        os.chdir('foo')
        os.makedirs('bar')
        touch('bar/baz')
        mgr._run_hg('addremove')
        mgr._run_hg('ci', '-m', 'committed')
        with open('bar/baz', 'w') as baz:
            baz.write('content')
        mgr._run_hg('ci', '-m', 'added content')
        yield
Esempio n. 3
0
 def setup_method(self, method):
     self.context = test_repo()
     self.context.__enter__()
     self.mgr = managers.SubprocessManager('.')
Esempio n. 4
0
 def test_current_dir_in_child(self):
     with test_repo():
         os.chdir('bar')
         test_mgr = managers.SubprocessManager('.')
         assert test_mgr.find_files() == ['baz']
Esempio n. 5
0
 def test_manager_in_child(self):
     with test_repo():
         test_mgr = managers.SubprocessManager('bar')
         assert test_mgr.find_files() == ['baz']
Esempio n. 6
0
 def test_nested_child(self):
     with test_repo():
         test_mgr = managers.SubprocessManager('.')
         assert test_mgr.find_files() == [os.path.join('bar', 'baz')]