Bug 211174 - www/py-flask-restplus: make test does nothing
Summary: www/py-flask-restplus: make test does nothing
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Jan Beich
URL:
Keywords: patch
Depends on: 210979
Blocks:
  Show dependency treegraph
 
Reported: 2016-07-17 15:42 UTC by Jan Beich
Modified: 2016-07-20 12:17 UTC (History)
2 users (show)

See Also:
jbeich: merge-quarterly-


Attachments
partial fix (1.09 KB, patch)
2016-07-17 15:42 UTC, Jan Beich
no flags Details | Diff
QA: poudriere testing session (33.23 KB, application/x-gzip)
2016-07-17 15:47 UTC, Jan Beich
no flags Details
partial fix (2.86 KB, patch)
2016-07-18 19:25 UTC, Jan Beich
no flags Details | Diff
fix: extra distfile version (5.28 KB, patch)
2016-07-19 18:45 UTC, Jan Beich
jbeich: maintainer-approval? (andrej)
Details | Diff
fix: USE_GITHUB version (4.56 KB, patch)
2016-07-19 18:46 UTC, Jan Beich
andrej: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2016-07-17 15:42:52 UTC
Created attachment 172608 [details]
partial fix

test target in setup.py seems to be a stub. In order to run tests one has to use devel/py-test.

  $ make test
  [...]
  ----------------------------------------------------------------------
  Ran 0 tests in 0.000s

  OK

After applying the patch

  $ make test
  [...]
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

      def _find_app():
          top = _app_ctx_stack.top
          if top is None:
  >           raise RuntimeError(_app_ctx_err_msg)
  E           RuntimeError: Working outside of application context.
  E
  E           This typically means that you attempted to use functionality that needed
  E           to interface with the current application object in a way.  To solve
  E           this set up an application context with app.app_context().  See the
  E           documentation for more information.

  /usr/local/lib/python2.7/site-packages/flask/globals.py:51: RuntimeError
  =============== 34 failed, 502 passed, 20 error in 2.89 seconds ================
  *** [do-test] Error code 1
Comment 1 Jan Beich freebsd_committer 2016-07-17 15:47:24 UTC
Created attachment 172609 [details]
QA: poudriere testing session

As poudriere has yet to support |make test| per https://github.com/freebsd/poudriere/pull/355 so here's a full session recorded by script(1) for attachment 172608 [details].

  $ gunzip py-flask-restplus.make-test.typescript.gz
  $ script -p py-flask-restplus.make-test.typescript
Comment 2 Jan Beich freebsd_committer 2016-07-18 19:23:48 UTC
Swap bug dependencies due to bug 203179.
Comment 3 Jan Beich freebsd_committer 2016-07-18 19:25:38 UTC
Created attachment 172675 [details]
partial fix

Rebased after ports r418732.
Comment 4 Andrej Ebert 2016-07-19 07:09:34 UTC
First, thanks for all the commits @ Jan Beich.

Secondly, I looked at it, but I'm seriously out of my depth here, it's something to do with Flask and it's app_context() which somehow doesn't get defined, and maybe paths? I thought maybe it doesn't like staging, but that wasn't it either.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2016-07-19 09:41:55 UTC
Reporter is committer and working on the issue, assign accordingly
Comment 6 Jan Beich freebsd_committer 2016-07-19 18:45:21 UTC
Created attachment 172731 [details]
fix: extra distfile version

I was curious and checked out the repo from github only to discover the issue is gone. It seems PyPI tarball doesn't include postman-v1.schema.json, not to mention the file has to be in the build (vs. source) directory.

$ make test -C www/py-flask-restplus08
[...]
======================================= test session starts ========================================
platform freebsd11 -- Python 2.7.12, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /usr/ports/www/py-flask-restplus08/work/flask-restplus-0.8.6, inifile:
plugins: capturelog-0.7
collected 426 items

tests/test_api.py .....................
tests/test_apidoc.py ..........
tests/test_errors.py .............................
tests/test_fields_mask.py ...............................................................................
tests/test_marshalling.py ......................
tests/test_model.py .............
tests/test_payload.py ...........
tests/test_postman.py ..............
tests/test_reqparse.py .................................................................................................
tests/test_swagger.py .........................................................................................
tests/test_swagger_utils.py .............................
tests/test_utils.py ............

========================== 426 passed, 1 pytest-warnings in 0.88 seconds ===========================

$ make test -C www/py-flask-restplus
[...]
======================================= test session starts ========================================
platform freebsd11 -- Python 2.7.12, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /usr/ports/www/py-flask-restplus/work/flask-restplus-0.9.2, inifile:
plugins: capturelog-0.7
collected 551 items

tests/test_accept.py ............
tests/test_api.py .....................
tests/test_apidoc.py ............
tests/test_cors.py ...
tests/test_errors.py ...............................
tests/test_fields_mask.py ...............................................................................
tests/test_marshalling.py ......................
tests/test_model.py ..................
tests/test_namespace.py ........
tests/test_payload.py ...........
tests/test_postman.py ...............
tests/test_reqparse.py ................................................................................................................
tests/test_swagger.py ..............................................................................................
tests/test_swagger_utils.py ..............
tests/test_utils.py ............
tests/legacy/test_api.py ...........................................................................
tests/legacy/test_api_with_blueprint.py ............

========================== 551 passed, 1 pytest-warnings in 1.36 seconds ===========================
Comment 7 Jan Beich freebsd_committer 2016-07-19 18:46:54 UTC
Created attachment 172732 [details]
fix: USE_GITHUB version

Approve only one version.
Comment 8 Andrej Ebert 2016-07-19 19:11:57 UTC
I find switching to GitHub cleaner, don't you? The + means I approved it, i hope? Never had to approve a change here(or maintained a port, for that matter), portlint just wouldn't let me put freebsd-ports-bugs@FreeBSD.org as maintainer for a new port. ;)
Comment 9 commit-hook freebsd_committer 2016-07-19 19:13:00 UTC
A commit references this bug:

Author: jbeich
Date: Tue Jul 19 19:12:42 UTC 2016
New revision: 418812
URL: https://svnweb.freebsd.org/changeset/ports/418812

Log:
  www/py-flask-restplus{,08}: fix |make test| via pytest

  - Switch to USE_GITHUB as postman-v1.schema.json isn't included in PyPI tarball

  PR:		211174
  Approved by:	Andrej Ebert <andrej@ebert.su> (maintainer)

Changes:
  head/www/py-flask-restplus/Makefile
  head/www/py-flask-restplus/distinfo
  head/www/py-flask-restplus08/Makefile
  head/www/py-flask-restplus08/distinfo
Comment 10 Jan Beich freebsd_committer 2016-07-19 19:18:04 UTC
Thanks. Landed. No MFH as www/py-flask-restplus* don't exist on 2016Q3.

(In reply to Andrej Ebert from comment #8)
> The + means I approved it, i hope?

maintainer-approval+ is correct but some folks abuse maintainer-feedback flag as well. I find maintainer-feedback flag quite useless (compared to relative timestamps) but koobs@ disagrees.
Comment 11 Kubilay Kocak freebsd_committer freebsd_triage 2016-07-20 12:16:43 UTC
(In reply to Jan Beich from comment #10)

maintainer-feedback flag (on the issue) is for feedback on the issue
maintainer-approval flag (on attachments) is for approval of patches (attachments)

The former is for determining maintainer 'timeouts', and is not perfect, i agree, but not useless.
The latter is for determining maintainer 'approval'
Comment 12 Kubilay Kocak freebsd_committer freebsd_triage 2016-07-20 12:17:17 UTC
:)