Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

feat: Github action integrated with codecov #632

Merged
merged 8 commits into from
Aug 22, 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
41 changes: 41 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run Tests

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:
runs-on: ubuntu-18.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
cp .env.example .env
python -m pip install --upgrade pip
pip install -r requirements/dev.txt
sudo apt-get install python-gdal
python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords')"

- name: Run Flake Test
satya7289 marked this conversation as resolved.
Show resolved Hide resolved
run: flake8 systers_portal

- name: Run Tests
run: coverage run systers_portal/manage.py test --settings=systers_portal.settings.testing

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
name: codecov-umbrella
fail_ci_if_error: true
55 changes: 0 additions & 55 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Systers Portal [![Build Status](https://travis-ci.org/systers/portal.svg?branch=master)](https://travis-ci.org/systers/portal) [![Coverage Status](https://coveralls.io/repos/github/systers/portal/badge.svg?branch=master)](https://coveralls.io/r/systers/portal?branch=master)
Systers Portal [![Build Status](https://codecov.io/gh/anitab-org/portal/branch/develop/graph/badge.svg)](https://codecov.io/gh/anitab-org/portal/) [![Coverage Status](https://coveralls.io/repos/github/systers/portal/badge.svg?branch=master)](https://coveralls.io/r/systers/portal?branch=master)
==============

Systers Portal is for Systers communities to post and share information within
Expand Down
10 changes: 4 additions & 6 deletions systers_portal/meetup/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.utils.timezone import timedelta
from cities_light.models import City, Country
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError


from meetup.forms import (AddMeetupForm, EditMeetupForm,
Expand Down Expand Up @@ -61,9 +60,9 @@ def test_request_meetup_form_with_past_date(self):
date = (timezone.now() - timedelta(2)).date()
time = timezone.now().time()
data = {'title': 'Foo', 'slug': 'foo', 'date': date, 'time': time,
'meetup_location': self.location,
'meetup_location': self.location.id,
'description': "It's a test meetup."}
form = AddMeetupForm(data=data, created_by=self.systers_user, leader=self.systers_user)
form = RequestMeetupForm(data=data, created_by=self.systers_user)
self.assertFalse(form.is_valid())
self.assertTrue(form.errors['date'], ["Date should not be before today's date."])

Expand All @@ -72,13 +71,12 @@ def test_request_meetup_form_with_passed_time(self):
date = timezone.now().date()
time = (timezone.now() - timedelta(2)).time()
data = {'title': 'Foo', 'slug': 'foo', 'date': date, 'time': time,
'meetup_location': self.location,
'meetup_location': self.location.id,
'description': "It's a test meetup."}
form = AddMeetupForm(data=data, created_by=self.systers_user, leader=self.systers_user)
form = RequestMeetupForm(data=data, created_by=self.systers_user)
self.assertFalse(form.is_valid())
self.assertTrue(form.errors['time'],
["Time should not be a time that has already passed."])
self.assertRaises(ValidationError, form.clean_time())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand any of the changes here, and please don't remove a whole test check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check deeply then you come to know that these are test cases for RequestMeetupFormTestCase not AddMeetupFormTestCase that's why I am adding the RequestMeetupForm instead of AddMeetupForm Actually whole test cases are wrong..

Also, Here this line self.assertRaises(ValidationError, form.clean_time()) is not needed because in the clean_time method time is used for return ValidationError(however, here time is None because on adding requestmeetup due to clean_time method time will be None). You can check these phenomenon by printing form.clean().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for diving deep into this! Can you please open an issue about this?



class AddMeetupFormTestCase(MeetupFormTestCaseBase, TestCase):
Expand Down
8 changes: 2 additions & 6 deletions systers_portal/systers_portal/settings/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': config('DB_NAME', default='systersdb'),
'USER': config('DB_USER'),
'PASSWORD': config('DB_PASSWORD'),
'HOST': config('DB_HOST', default='localhost'),
'PORT': config('DB_PORT', default=5432, cast=int),
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}

Expand Down