-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Test pydata application #1073
Test pydata application #1073
Conversation
9deec81
to
b062943
Compare
python: | ||
- 3.5 | ||
|
||
env: | ||
- PYDATA=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyData app introduces a migration since it adds a choice
argument to the sponsorship amount field. So, I do not check for missing migrations here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is that migration? I can't find it.
OK, I see it.
@pbanaszkiewicz @chrismedrela |
38d4cea
to
28bc47b
Compare
git pull -q --no-edit origin develop; | ||
fi; | ||
- if [[ $PYDATA == true ]]; then | ||
git pull -q --no-edit origin deploy-pydata; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is in deploy-pydata
?
Are you sure git pull
is the right way to go?
Can we use git config --local
instead of git config --global
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly is in deploy-pydata?
Adds pydata
to INSTALLED_APPS and urlconfig. See the commit cf8603aa
Are you sure git pull is the right way to go?
Isn't pull
an aggregate command that executes fetch
and merge
. Shouldn't be a problem.
Can we use git config --local instead of git config --global?
The instances destruct after every test. It does not make a difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds pydata to INSTALLED_APPS and urlconfig. See the commit cf8603a
Why not conditionally include it in the config? It could be controlled via envvar.
Isn't pull an aggregate command that executes fetch and merge. Shouldn't be a problem.
Hmm well I can see some issues and questions here.
You're assuming that someone wants to merge into develop, which is not always true.
You're merging develop into PR branch (this may be the same as merging PR branch into develop - I'm not sure).
What happens when you get merge conflict. The test suite doesn't run?
And finally, according to the travis-ci docs:
Rather than test the commits that have been pushed to the branch the pull request is from, we test the merge between the origin and the upstream branch. To only build on push events, you can disable Build on Pull Requests from your repository settings.
So… is this what @chrismedrela intended in #1066?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not conditionally include it in the config? It could be controlled via envvar.
Nice suggestion. I am starting to reconsider #938. By overriding the envvar DJANGO_SETTINGS_MODULE
, we can switch between a normal deployment and a PyData deployment.
So… is this what @chrismedrela intended in #1066?
Please refer to the discussion at #1066. As you pointed out, Travis does merge the develop branch before testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the fix for #1066. Also, I am moving the discussion out of this comment thread.
Nice suggestion. I am starting to reconsider #938. By overriding the envvar DJANGO_SETTINGS_MODULE, we can switch between a normal deployment and a PyData deployment. |
exit 1; | ||
fi; | ||
fi; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@narayanaditya95 Could you create a new PR, exactly the same as this one, but please remove the last migration file (0122_auto_20161101_1441.py
) to proof that Travis build fails when there are missing migrations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1078
I'm 👍 for merging when these three issues above are addressed. I've created a new issue #1075 to address monkey patching issue. |
@chrismedrela
|
@narayanaditya95 I'd like to have everything on one branch ( |
BTW this is exactly what @pbanaszkiewicz has proposed:
|
1. Add fixtures introduced by pydata app in all tests 2. Mark tests that should fail as expectedFailures 3. Change amount field to one accepted by pydata app
419a3e4
to
c93da36
Compare
@chrismedrela Please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is tough, but I think we're pretty close to get this merged. :-)
One general question: right now, we've only one Travis job. It runs tests with pydata enabled. Should not we have another job with pydata disabled?
INSTALLED_APPS.insert( | ||
INSTALLED_APPS.index('workshops'), | ||
'pydata' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you replace it with:
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'workshops',
]
if ENABLE_PYDATA:
INSTALLED_APPS += [
'pydata',
]
INSTALLED_APPS += [
# this should be after 'workshops' because templates in
# 'templates/registration/' clash
'django.contrib.admin',
'crispy_forms',
'selectable',
'django_countries',
'django_filters',
'reversion',
'rest_framework',
'api',
'extforms',
'captcha',
'compressor',
'social.apps.django_app.default',
'debug_toolbar',
]
So that INSTALLED_APPS
is defined in one place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
@@ -338,6 +338,17 @@ | |||
}, | |||
} | |||
|
|||
# settings for PyData application | |||
ENABLE_PYDATA = os.environ.get('AMY_ENABLE_PYDATA', False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are valid values for AMY_ENABLE_PYDATA
envvar? Which ones are truthy and which ones are falsy? What if somebody sets AMY_ENABLE_PYDATA=false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably parse AMY_ENABLE_PYDATA
the same way we parse AMY_DEBUG
:
json.loads(os.environ.get('AMY_DEBUG', 'true'))
script: | ||
- python manage.py makemigrations --dry-run -e; export STATUS_CODE=$?; if [[ "$STATUS_CODE" == "0" ]]; then exit 1; fi | ||
- coverage run --source=amy,api,workshops manage.py test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pbanaszkiewicz, BTW where does it sends the coverage data?
@narayanaditya95 should we include pydata
in --source
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pbanaszkiewicz, BTW where does it sends the coverage data?
The coverage
command generates a report. The coveralls
command sends it to Coveralls.
@narayanaditya95 should we include pydata in --source?
I am not sure what will happen if two Travis jobs send coverage data to Coveralls for the same commit. Will it break?
@pbanaszkiewicz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The coverage command generates a report. The coveralls command sends it to Coveralls.
Yes, and where is the report available? https://coveralls.io/github/swcarpentry/amy results in 404.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only @pbanaszkiewicz has the permission to access coveralls.io
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I ever set up coveralls, but the codebase was ready for it.
|
||
|
||
if settings.ENABLE_PYDATA: | ||
urlpatterns.insert(1, url(r'^workshops/', include('pydata.urls'))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change it in a similar way to INSTALLED_APPS
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
'pydata' | ||
) | ||
PYDATA_USERNAME_SECRET = os.environ.get('AMY_PYDATA_USERNAME') | ||
PYDATA_PASSWORD_SECRET = os.environ.get('AMY_PYDATA_PASSWORD') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these two settings optional? That is, is None
valid value for both username and password?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. But we have checks in pydata/checks.py
to ensure these variables are not None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check_pydata_installed_before_workshops
checks only if these variables are set, but doesn't check if they're not None
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
- AMY_ENABLE_PYDATA=true | ||
AMY_PYDATA_USERNAME=username | ||
AMY_PYDATA_PASSWORD=password | ||
- CHECK_MIGRATION=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Is this necessary? We don't have two Travis jobs anymore.
- Previously, you couldn't enable pydata and, at the same time, enable migrations checks. What did you changed, that it works now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Yes, we need two Travis jobs. There are tests that are marked as expected failure by
pydata
app. We need to explicitly test them. - Even now pydata and migration aren't enabled at the same time. In the first Travis job, pydata is enabled. In the second, we check for migrations along with the standard deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see, these lines define two builds.
@pbanaszkiewicz could you review the design? |
c93da36
to
d481129
Compare
@@ -33,6 +33,13 @@ | |||
SECRET_KEY = None | |||
SECRET_KEY = os.environ.get('AMY_SECRET_KEY', SECRET_KEY) | |||
|
|||
# settings for PyData application | |||
ENABLE_PYDATA = json.loads(os.environ.get('AMY_ENABLE_PYDATA', 'false')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to add a layer of abstraction over this expression. :)
It took me a while to realize why json parsing was used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just add a comment? :-)
@chrismedrela |
@narayanaditya95 thank you for your work on this PR! @pbanaszkiewicz please merge if you like it. |
PR created to test whether Travis creates multiple jobs.