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

Packages are missing in GettingStarted and server tests fail #764

Closed
ryosuketc opened this issue Nov 11, 2020 · 4 comments
Closed

Packages are missing in GettingStarted and server tests fail #764

ryosuketc opened this issue Nov 11, 2020 · 4 comments
Assignees

Comments

@ryosuketc
Copy link
Contributor

tools/server_tests/ fails. It seems that some packages are missing from [GettingStarted](https://github.com/google/personfinder/wiki/GettingStarted). The missing ones have to be installed in a global environment, instead of app/vendors`.

flake8 might be one of them - #762.

======================================================================= ERRORS =======================================================================

___________________________________________ ERROR collecting tests/server_test_cases/person_note_tests.py ____________________________________________
ImportError while importing test module '$HOME/repos/pf/tests/server_test_cases/person_note_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/server_test_cases/person_note_tests.py:22: in <module>
    from parameterized import parameterized
E   ImportError: No module named parameterized
================================================================== warnings summary ==================================================================
tests/server_tests_base.py:69
  /usr/local/google/home/rtachibana/repos/pf/tests/server_tests_base.py:69: PytestDeprecationWarning: the `pytest.config` global is deprecated.  Please use `request.config` or `pytest_configure` (if you're a pytest plugin) instead.
    hostport = pytest.config.hostport

tests/server_tests_base.py:70
  /usr/local/google/home/rtachibana/repos/pf/tests/server_tests_base.py:70: PytestDeprecationWarning: the `pytest.config` global is deprecated.  Please use `request.config` or `pytest_configure` (if you're a pytest plugin) instead.
    mail_server = pytest.config.mail_server

-- Docs: https://docs.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================== 2 warnings, 1 error in 0.31 seconds =========================================================
@ryosuketc
Copy link
Contributor Author

ryosuketc commented Nov 19, 2020

@gimite
Is any action needed on Not Found: /personfinder/_ah/admin/tasks in server_tests (full results below)? Probably not...

 % tools/server_tests

--- Updating translations
processing locale en
No messages have changed.

--- Running server tests
SMTP server started.
appserver started.
================================================================ test session starts =================================================================
platform linux2 -- Python 2.7.18, pytest-4.6.11, py-1.9.0, pluggy-0.13.1
rootdir: /usr/local/google/home/rtachibana/repos/pf
collected 146 items                                                                                                                                  

tests/server_test_cases/config_tests.py ...........                                                                                            [  7%]
tests/server_test_cases/download_feed_tests.py ...                                                                                             [  9%]
tests/server_test_cases/import_tests.py ...........                                                                                            [ 17%]
tests/server_test_cases/input_escaping_tests.py .....                                                                                          [ 20%]
tests/server_test_cases/person_note_tests.py ...................................................................................               [ 77%]
tests/server_test_cases/photo_tests.py F...FF                                                                                                  [ 81%]
tests/server_test_cases/read_only_tests.py .....................                                                                               [ 95%]
tests/server_test_cases/resource_tests.py ..                                                                                                   [ 97%]
tests/server_test_cases/usage_counters_tests.py ....                                                                                           [100%]
====================================================================== FAILURES ======================================================================

___________________________________________________________ PhotoTests.test_set_thumbnail ____________________________________________________________
tests/server_test_cases/photo_tests.py:114: in test_set_thumbnail
    assert image.height == MAX_THUMBNAIL_DIMENSION
E   AssertionError: assert 100 == 80
E    +  where 100 = <google.appengine.api.images.Image object at 0x7fcf470fac10>.height
---------------------------------------------------------------- Captured stderr call ----------------------------------------------------------------
> GET http://localhost:8081/personfinder/haiti/tasks/thumbnail_preparer
> GET http://localhost:8081/haiti/photo?id=6407953766678528&thumb=true

____________________________________________________________ PhotoTests.test_upload_photo ____________________________________________________________
tests/server_test_cases/photo_tests.py:46: in test_upload_photo
    photo = doc.cssselect_one('img.photo')
tests/scrape.py:589: in cssselect_one
    % expr)
E   AssertionError: cssselect_one('img.photo') was called, but there are no matching elements.
---------------------------------------------------------------- Captured stderr call ----------------------------------------------------------------
> GET http://localhost:8081/personfinder/haiti/create?role=provide
> POST http://localhost:8081/personfinder/haiti/create

_________________________________________________ PhotoTests.test_upload_photos_with_transformation __________________________________________________
tests/server_test_cases/photo_tests.py:72: in test_upload_photos_with_transformation
    assert len(photos) == 2
E   AssertionError: assert 0 == 2
E    +  where 0 = len([])
---------------------------------------------------------------- Captured stderr call ----------------------------------------------------------------
> GET http://localhost:8081/personfinder/haiti/create?role=provide
> POST http://localhost:8081/personfinder/haiti/create
================================================================== warnings summary ==================================================================
tests/server_tests_base.py:69
  /usr/local/google/home/rtachibana/repos/pf/tests/server_tests_base.py:69: PytestDeprecationWarning: the `pytest.config` global is deprecated.  Please use `request.config` or `pytest_configure` (if you're a pytest plugin) instead.
    hostport = pytest.config.hostport

tests/server_tests_base.py:70
  /usr/local/google/home/rtachibana/repos/pf/tests/server_tests_base.py:70: PytestDeprecationWarning: the `pytest.config` global is deprecated.  Please use `request.config` or `pytest_configure` (if you're a pytest plugin) instead.
    mail_server = pytest.config.mail_server

tests/server_test_cases/input_escaping_tests.py::InputEscapingTests::test_xss_photo
tests/server_test_cases/input_escaping_tests.py::InputEscapingTests::test_xss_photo
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_delete_and_restore
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_delete_and_restore
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_delete_and_restore
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_delete_and_restore
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_delete_and_wipe
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_delete_and_wipe
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_delete_and_wipe
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_delete_and_wipe
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_photo
tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_photo
tests/server_test_cases/photo_tests.py::PhotoTests::test_set_thumbnail
tests/server_test_cases/photo_tests.py::PhotoTests::test_skip_thumbnail_for_small_enough_images
tests/server_test_cases/photo_tests.py::PhotoTests::test_skip_thumbnail_for_small_enough_images
tests/server_test_cases/resource_tests.py::ResourceTests::test_resource_override
tests/server_test_cases/resource_tests.py::ResourceTests::test_resource_override
  /usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/api/datastore_types.py:1226: DeprecationWarning: object.__init__() takes no parameters
    super(Blob, self).__init__(*args, **kwargs)

tests/server_test_cases/person_note_tests.py::PersonNoteTests::test_seeking_someone_small
  /usr/local/google/home/rtachibana/repos/pf/app/vendors/unidecode/__init__.py:46: RuntimeWarning: Argument <type 'str'> is not an unicode object. Passing an encoded string will likely have unexpected results.
    _warn_if_not_unicode(string)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
================================================ 3 failed, 143 passed, 20 warnings in 201.13 seconds =================================================

--- output from appserver ---
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test2@example.com
  Subject: [Person Finder] Deletion notice for "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 237
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test@example.com
  Subject: [Person Finder] Deletion notice for "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 574
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: testsubscribe@example.com
  Subject: [Person Finder] You are subscribed to status updates for _test_full_name
  Body:
    Content-type: text/plain
    Data length: 378
Not Found: /personfinder/_ah/admin/tasks
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: testsubscribe@example.com
  Subject: [Recherche de personnes] Vous êtes abonné aux mises à jour du statut concernant "_test_full_name"
  Body:
    Content-type: text/plain
    Data length: 483
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test@example.com
  Subject: [Person Finder] Deletion notice for "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 574
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test2@example.com
  Subject: [Person Finder] Deletion notice for "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 237
Not Found: /personfinder/_ah/admin/tasks
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test@example.com
  Subject: [Person Finder] Record restoration notice for "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 373
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test2@example.com
  Subject: [Person Finder] Record restoration notice for "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 373
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test@example.com
  Subject: [Person Finder] Deletion notice for "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 574
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test2@example.com
  Subject: [Person Finder] Deletion notice for "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 237
Not Found: /personfinder/_ah/admin/tasks
Not Found: /personfinder/_ah/admin/tasks
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test1@example.com
  Subject: [Person Finder] Confirm your note on "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 364
Not Found: /personfinder/_ah/admin/tasks
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: test2@example.com
  Subject: [Person Finder] Confirm your note on "_test_given_name _test_family_name"
  Body:
    Content-type: text/plain
    Data length: 347
Not Found: /personfinder/_ah/admin/tasks
/usr/local/google/home/rtachibana/repos/pf/app/vendors/unidecode/__init__.py:46: RuntimeWarning: Argument <type 'str'> is not an unicode object. Passing an encoded string will likely have unexpected results.
  _warn_if_not_unicode(string)
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: testsubscribe@example.com
  Subject: [Person Finder] You are subscribed to status updates for _test_full_name
  Body:
    Content-type: text/plain
    Data length: 378
Not Found: /personfinder/_ah/admin/tasks
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: testsubscribe@example.com
  Subject: [Recherche de personnes] Vous êtes abonné aux mises à jour du statut concernant "_test_full_name"
  Body:
    Content-type: text/plain
    Data length: 483
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: example1@example.com
  Subject: [Recherche de personnes] Mise à jour du statut concernant "_test_full_name1"
  Body:
    Content-type: text/plain
    Data length: 741
Not Found: /personfinder/_ah/admin/tasks
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: example2@example.com
  Subject: [Recherche de personnes] Mise à jour du statut concernant "_test_full_name2"
  Body:
    Content-type: text/plain
    Data length: 683
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: example1@example.com
  Subject: [Recherche de personnes] Mise à jour du statut concernant "_test_full_name1"
  Body:
    Content-type: text/plain
    Data length: 683
Not Found: /personfinder/_ah/admin/tasks
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: example2@example.com
  Subject: [Recherche de personnes] Mise à jour du statut concernant "_test_full_name3"
  Body:
    Content-type: text/plain
    Data length: 741
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: example1@example.com
  Subject: [Recherche de personnes] Mise à jour du statut concernant "_test_full_name3"
  Body:
    Content-type: text/plain
    Data length: 741
Not Found: /personfinder/_ah/admin/tasks
  From: Do not reply <do-not-reply@googlepersonfinder.appspotmail.com>
  To: example1@example.com
  Subject: [Recherche de personnes] Mise à jour du statut concernant "_test_full_name"
  Body:
    Content-type: text/plain
    Data length: 780
Not Found: /personfinder/_ah/admin/tasks
Not Found: /personfinder/_ah/admin/tasks
ERROR    2020-11-19 06:08:22,407 api_server.py:385] Exception while handling images.Transform()
Traceback (most recent call last):
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 353, in _handle_POST
    api_response = _execute_request(request).Encode()
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 172, in _execute_request
    make_request()
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 164, in make_request
    request_id)
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/api/images/images_not_implemented_stub.py", line 54, in MakeSyncCall
    raise NotImplementedError('Unable to find the Python PIL library.  Please '
NotImplementedError: Unable to find the Python PIL library.  Please view the SDK documentation for details about installing PIL on your system.
ERROR    2020-11-19 06:08:22,408 webapp2.py:1552] 
Traceback (most recent call last):
  File "/usr/local/google/home/rtachibana/opt/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1535, in __call__
    rv = self.handle_exception(request, response, e)
  File "/usr/local/google/home/rtachibana/opt/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1529, in __call__
    rv = self.router.dispatch(request, response)
  File "/usr/local/google/home/rtachibana/opt/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/usr/local/google/home/rtachibana/opt/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/usr/local/google/home/rtachibana/opt/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File "/usr/local/google/home/rtachibana/opt/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 570, in dispatch
    return method(*args, **kwargs)
  File "/usr/local/google/home/rtachibana/repos/pf/app/main.py", line 554, in get
    self.serve()
  File "/usr/local/google/home/rtachibana/repos/pf/app/main.py", line 548, in serve
    getattr(handler, request.method.lower())()  # get() or post()
  File "/usr/local/google/home/rtachibana/repos/pf/app/tasks.py", line 394, in get
    photo.set_thumbnail(p)
  File "/usr/local/google/home/rtachibana/repos/pf/app/photo.py", line 98, in set_thumbnail
    raise PhotoError()
PhotoError
ERROR    2020-11-19 06:08:24,992 api_server.py:385] Exception while handling images.Transform()
Traceback (most recent call last):
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 353, in _handle_POST
    api_response = _execute_request(request).Encode()
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 172, in _execute_request
    make_request()
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 164, in make_request
    request_id)
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/api/images/images_not_implemented_stub.py", line 54, in MakeSyncCall
    raise NotImplementedError('Unable to find the Python PIL library.  Please '
NotImplementedError: Unable to find the Python PIL library.  Please view the SDK documentation for details about installing PIL on your system.
ERROR    2020-11-19 06:08:25,510 api_server.py:385] Exception while handling images.Transform()
Traceback (most recent call last):
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 353, in _handle_POST
    api_response = _execute_request(request).Encode()
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 172, in _execute_request
    make_request()
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 164, in make_request
    request_id)
  File "/usr/local/google/home/rtachibana/opt/google_appengine/google/appengine/api/images/images_not_implemented_stub.py", line 54, in MakeSyncCall
    raise NotImplementedError('Unable to find the Python PIL library.  Please '
NotImplementedError: Unable to find the Python PIL library.  Please view the SDK documentation for details about installing PIL on your system.

appserver failed (status None).

SMTP server stopped.
Command exited with non-zero status 1

@ryosuketc
Copy link
Contributor Author

ryosuketc commented Nov 19, 2020

Added instructions on virtualenv to GettingStarted, which was used to address the issue (and we might eventually use it for Python 3 migration)
https://github.com/google/personfinder/wiki/GettingStarted/_compare/83862df7ff8d91daf69359834b49ac8abadbffad

@gimite
Copy link
Contributor

gimite commented Nov 19, 2020

Yeah not exactly sure what Not Found: /personfinder/_ah/admin/tasks means, but I guess you can ignore it. It is not an error in the test, just part of the appserver output.

@ryosuketc
Copy link
Contributor Author

Thanks.

Since I forgot flake8 as another missing package, I added it in the GettingStarted #762

This PR #765 includes all the fixes assuming we can ignore Not Found.... I'd appreciate your review :)

gimite pushed a commit that referenced this issue Nov 24, 2020
* Support an optional argument --skip_update_translations #763

* Skip app/vendors from compilemessages #763

* Add venv/ to .gitignore to support virtualenv #764

* Use boolean instead of strings to dispatch behavior of server tests by optional arguments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants