-
Notifications
You must be signed in to change notification settings - Fork 0
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
Un dev #63
base: master
Are you sure you want to change the base?
Un dev #63
Conversation
.travis.yml
Outdated
<<<<<<< HEAD | ||
- flake8 | ||
======= | ||
- flake8 --exclude=doorknob/__init__.py,migrations | ||
>>>>>>> c7b73082a79eef302b7168ff3e80dc3c2293398b |
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.
@uyennguyen16900 , it looks like you changed the command for flake8
on your branch. Was the previous command (the one that says - flake8 --exclude=doorknob/__init__.py,migrations
giving you errors?
In it's current state these 5 lines will cause a merge conflict, so if there are no errors using the 2nd command I think we should choose that over the basic - flake8
, as it skips over certain files during testing that we don't need to worry about.
aws_data: A list of detected face json objects generated by AWS | ||
Rekognition. | ||
aws_data: A list of detected face json objects generated by AWS Rekognition. |
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 appreciate that you made the docstring look simpler @uyennguyen16900 . However this line 16 is a little long, it is 85 characters and the Pep 8 standard is to keep it below 80. You don't need to make it go onto the next line, but you please try and make the line length < 80 somehow?
doorknob/tests/test_foyer.py
Outdated
@@ -1,8 +1,7 @@ | |||
import json | |||
import unittest | |||
|
|||
from doorknob.foyer import Scene | |||
|
|||
from foyer import Scene |
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.
Importing from a higher level package in Python 3 is pretty tricky, and when I ran pytest
on my machine this line caused a ModuleNotFoundError
. However, could you try switching this line to from doorknob.foyer import Scene
. Then, please verify with pytest
that all the errors are resolved.
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 had no module error because they are not in the same package. That's why I moved test_detect.py
to its parent folder.
doorknob/test_detect.py
Outdated
from freezegun import freeze_time | ||
from detect import VideoDetect | ||
|
||
from moto import mock_sns, mock_sqs |
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 imports in these lines are also causing ModuleNotFound
errors. Would you please make sure to freeze your requirements on requirements/local.txt
and requirements/production.txt
files if you installed new packages?
watch/tests.py
Outdated
from django.test import Client, TestCase | ||
from django.test import TestCase, Client | ||
from django.test.client import RequestFactory | ||
from watch.views import HomeView | ||
from django.urls import reverse, reverse_lazy | ||
from .views import ( | ||
HomeView, | ||
WatchedView, | ||
) | ||
from django.core.files.uploadedfile import SimpleUploadedFile |
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.
Run isort watch/tests.py
to double check the order of your imports is correct.
tinydoor/templates/pages/home.html
Outdated
@@ -34,6 +45,7 @@ <h1 class="display-4">Measure User Satisfaction</h1> | |||
</div> | |||
<!--end of container--> | |||
<!--end of section--> | |||
>>>>>>> c7b73082a79eef302b7168ff3e80dc3c2293398b |
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.
Lines 11-48 shows that we have another merge conflict. When I ran this on localhost
, the upload button on your branch is not as stylish as the one on the master
.
Did you experience any error with the version of the upload button currently on master @uyennguyen16900? I think if it's possible we should just keep the upload button as is, as it will look better.
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'm sure why we have a merge conflict here since I haven't changed anything in html files.
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 it's no problem. The conflict is probably because you just might not have pulled from the master
branch in a while, because I'm assuming this branch was created a while back, before we integrated the Bootstrap theme into the HTML.
doorknob/test_detect.py
Outdated
|
||
expected = MESSAGE_FROM_SQS % (message, published_message_id, "us-west-1") | ||
acquired_message = re.sub( | ||
"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z", |
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.
Interesting thing I learned about about Regular Expressions:
It is considered best practice to prepend your regex with an "r" - this helps the linter from throwing weird errors, such as thinking the "\d" is an escape sequence or something like that.
You can read more about that on this page from Flake8 Rules.
doorknob/tests/test_foyer.py
Outdated
<<<<<<< HEAD | ||
======= | ||
|
||
>>>>>>> 7947f58b3010bd6e94e4351e2d33a23f81608875 |
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.
@uyennguyen16900 please delete lines 5, 6, and 8. The git diff markers need to be removed, as they will cause the tests to fail.
doorknob/tests/test_foyer.py
Outdated
@@ -16,6 +20,7 @@ def test_no_emotions(self): | |||
with self.assertRaises(ValueError): | |||
Scene(aws_data=json.load(f)) | |||
|
|||
|
|||
class VideoDetectTestCase(unittest.TestCase): | |||
""" |
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.
You can delete this class declaration now, since I see that you already have the tests for VideoDetect
in another file.
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 ran the SceneTestCase test class and they failed.
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.
Hey @uyennguyen16900 - this PR is awesome.
Only some minor changes are needed, see my comments to help you because they mainly have to do with formatting.
Also, be sure to run black .
at the top level of your local repo, so it can auto-fix some formatting errors. The command flake8 --exclude=migrations,env
will also help highlight these for you.
Right now the main problem with the tests is in test_tasks.py
, on line 7 when you call the reverse()
with "run_task" as the argument. My question is: is the reverse function being used supposed to come from Django, or does it come from another library? Because right now the test thinks the argument is supposed to be the name of a view, and it fails because it can't find it.
Kudos for learning the moto package all by yourself!
|
Oh no you're good! I was just curious in case the moto package had its own reverse function or something. Code review is a good learning opportunity for both people. |
doorknob/test_detect.py
All tests pass, except the first one.
I set the region to us-west-1, but I don't know why the regions for "SigningCertURL" and "UnsubscribeURL" are us-east-1.
In line 63 I compare acquired_message dict with expected dict.
Here is the output for print(acquired_message)
Here is the output for print(expected)