def test_valid_repo(self): code_dir = self.tmp_dir os.environ['WHEELJACK_CODE'] = code_dir try: install_repo('nuggets', config=self.config, git_command=mock_git_command) except GitNotRepoException: pass # We are testing for something else. # Let's make sure it creates a directory. self.assertTrue(os.path.exists(os.path.join(code_dir, 'nuggets')))
def test_create_pth_existing_repo(self): """If there's an existing repo and no pth file we should create one.""" os.environ['WHEELJACK_CODE'] = self.tmp_dir new_dir = os.path.join(self.tmp_dir, 'nuggets') os.mkdir(new_dir) config = yaml.load(DUMMY_CONFIG) install_repo('nuggets', config=config) destination = '.venv/lib/python2.7/site-packages/nuggets.pth' ok_(os.path.exists(os.path.join(self.tmp_dir, destination)), ".pth file not created in {}".format(destination)) with open(os.path.join(self.tmp_dir, destination)) as f: expect = 3 reality = len(f.readlines()) eq_(expect, reality, "Expected {} lines, got {}".format(expect, reality))