def test_05_get_builds_empty(self): "Test fetching of data" api.requests.status_code = 200 user, repo = ENV['CI_REPO_NAME'].split('/') cov = api.API(user, repo, token=ENV['COVERALLS_REPO_TOKEN']) actually = len(list(cov.builds('dontmindme'))) expected = 1 self.assertEqual(expected, actually)
def test_01_smoke(self): "Just a smoke test." api.requests.status_code = 200 user, repo = ENV['CI_REPO_NAME'].split('/') cov = api.API(user, repo, token=ENV['COVERALLS_REPO_TOKEN']) cov.set_source_files(self.path, strip_path='') cov.set_build_values() cov.set_dvcs_user(ENV['CI_COMMITTER_NAME'], ENV['CI_COMMITTER_EMAIL']) cov.set_dvcs_commit( ENV['CI_COMMIT_ID'], ENV['CI_MESSAGE'], ENV['CI_BRANCH'], ) cov.upload_coverage() api.requests.status_code = 404 self.assertRaises(ValueError, cov.upload_coverage)
def make_coverage_data(): "make coverage data" old = os.path.abspath(os.getcwd()) nwd = os.path.dirname(os.path.abspath(__file__)) os.chdir(nwd) cov = coverage.coverage(data_file=os.path.join(nwd, 'coverage.dat')) cov.start() coveralls = api.API('x', 'y', 'z') try: coveralls.upload_coverage() except: # pylint: disable=bare-except # we just want some coverage data, it does not really matter what it is. pass cov.stop() cov.save() os.chdir(old)
def test_11_check(self): "Test setting data." user, repo = ENV['CI_REPO_NAME'].split('/') _ = api.API(user, repo, token=ENV['COVERALLS_REPO_TOKEN']) self.assertRaises(ValueError, _._check_upload)
def test_10_set_with_remote(self): "Test setting data." user, repo = ENV['CI_REPO_NAME'].split('/') _ = api.API(user, repo, token=ENV['COVERALLS_REPO_TOKEN']) _.set_dvcs_commit('id', 'message', 'branch', ['remotes']) self.assertIn('remotes', _.settings['UPLOAD']['git'])
def test_03_get_builds_error(self): "Test fetching of data" api.requests.status_code = 404 user, repo = ENV['CI_REPO_NAME'].split('/') cov = api.API(user, repo, token=ENV['COVERALLS_REPO_TOKEN']) self.assertRaises(ValueError, list, cov.list_builds())