Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the failing Continuous Integration build on master as well as fork #242

Merged
merged 6 commits into from
Jul 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .coafile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[all]
files = **.py, **.js, **.sh
ignore = .git/**, **/__pycache__/**, gci/client.py, */migrations/**, private/*
ignore = .git/**, **/__pycache__/**, gci/client.py, */migrations/**, private/*, openhub/**
max_line_length = 80
use_spaces = True
preferred_quotation = '
Expand Down
8 changes: 3 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ coverage.xml
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
Expand Down Expand Up @@ -272,6 +273,7 @@ flycheck_*.el

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
Expand Down Expand Up @@ -429,11 +431,7 @@ DerivedData/
*.perspectivev3
!default.perspectivev3

## Xcode Patch
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
## Gcc Patch
/*.gcno

# Eclipse rules
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: python
python: 3.6
python: 3.6.3

cache:
pip: true
Expand Down
6 changes: 3 additions & 3 deletions community/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_config_remote(name='origin'):
raise KeyError('No git remotes found')


def get_remote_url():
def get_remote_url(name='origin'):
"""Obtain a parsed remote URL.

Uses CI environment variables or git remotes.
Expand All @@ -58,7 +58,7 @@ def get_remote_url():
# It only sets the REPOSITORY_URL
url = os.environ.get('REPOSITORY_URL')
if not url:
remote = get_config_remote()
remote = get_config_remote(name)
assert remote[0][0] == 'url'
url = remote[0][1]

Expand Down Expand Up @@ -146,7 +146,7 @@ def get_upstream_repo():
"""Obtain the parent slug of the repository.
"""
try:
remote = get_config_remote(name='upstream')
remote = get_remote_url(name='origin')
except KeyError:
remote = None

Expand Down
3 changes: 1 addition & 2 deletions data/contrib_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ def get_contrib_data():
def import_data(contributor):
logger = logging.getLogger(__name__)
login = contributor.get('login', None)
teams = contributor.get('teams')
teams = contributor.pop('teams')
try:
contributor['issues_opened'] = contributor.pop('issues')
contributor['num_commits'] = contributor.pop('contributions')
contributor.pop('teams')
c, create = Contributor.objects.get_or_create(
**contributor
)
Expand Down
33 changes: 33 additions & 0 deletions data/migrations/0005_auto_20190801_1442.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 2.1.7 on 2019-08-01 14:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('data', '0004_auto_20180809_2229'),
]

operations = [
migrations.AddField(
model_name='contributor',
name='followers',
field=models.IntegerField(default=None, null=True),
),
migrations.AddField(
model_name='contributor',
name='location',
field=models.TextField(default=None, null=True),
),
migrations.AddField(
model_name='contributor',
name='public_gists',
field=models.IntegerField(default=None, null=True),
),
migrations.AddField(
model_name='contributor',
name='public_repos',
field=models.IntegerField(default=None, null=True),
),
]
4 changes: 4 additions & 0 deletions data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ class Contributor(models.Model):
name = models.TextField(default=None, null=True)
bio = models.TextField(default=None, null=True)
num_commits = models.IntegerField(default=None, null=True)
public_repos = models.IntegerField(default=None, null=True)
public_gists = models.IntegerField(default=None, null=True)
followers = models.IntegerField(default=None, null=True)
reviews = models.IntegerField(default=None, null=True)
issues_opened = models.IntegerField(default=None, null=True)
location = models.TextField(default=None, null=True)
teams = models.ManyToManyField(Team)

def __str__(self):
Expand Down
8 changes: 7 additions & 1 deletion data/tests/test_contrib_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

from django.test import TestCase

from data.contrib_data import get_contrib_data
from data.contrib_data import get_contrib_data, import_data
from gamification.tests.test_management_commands import (
get_false_contributors_data)


class GetContribDataTest(TestCase):

def test_get_contrib_data(self):
with requests_mock.Mocker():
get_contrib_data()

def test_false_contributor_data(self):
for contrib in get_false_contributors_data():
import_data(contrib)
8 changes: 7 additions & 1 deletion data/tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

from django.test import TestCase

from data.issues import fetch_issues
from data.issues import fetch_issues, import_issue
from gamification.tests.test_management_commands import (
get_false_issues_data)


class FetchIssueTest(TestCase):

def test_fetch_issues(self):
with requests_mock.Mocker():
fetch_issues('GitHub')

def test_false_issue_data(self):
for issue in get_false_issues_data():
import_issue('github', issue)
6 changes: 2 additions & 4 deletions data/tests/test_management_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def test_command_import_issues_data(self):
if not issues:
raise unittest.SkipTest(
'No record of issues from webservices')
self.assertIn('testuser',
[issue.author.login for issue in issues])
self.assertGreater(issues.count(), 0)


class ImportMergeRequestDataTest(TestCase):
Expand All @@ -47,5 +46,4 @@ def test_command_import_issues_data(self):
if not mrs:
raise unittest.SkipTest(
'No record of mrs from webservices')
self.assertIn('testuser',
[mr.author.login for mr in mrs])
self.assertGreater(mrs.count(), 0)
7 changes: 6 additions & 1 deletion data/tests/test_merge_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

from django.test import TestCase

from data.merge_requests import fetch_mrs
from data.merge_requests import fetch_mrs, import_mr
from gamification.tests.test_management_commands import (get_false_mrs_data)


class FetchMergeRequestTest(TestCase):

def test_fetch_mrs(self):
with requests_mock.Mocker():
fetch_mrs('GitHub')

def test_false_mr_data(self):
for mr in get_false_mrs_data():
import_mr('github', mr)
Loading