We try to follow a good git workflow.[1]

The error provides instructions of what to do.

astuce: Pull distant changes (e.g. 'git pull ...')
astuce: before pushing. [...]").

Which implies you did not follow the helpful instructions in contributing.md under "Building documentation for a Pylons Project project", steps 6-10[1] which I wrote to prevent such occurrences. I haz a sad. :-(

[1] https://help.github.com/articles/what-is-a-good-git-workflow/
[2] 
https://github.com/Pylons/pyramid/blob/master/contributing.md#building-documentation-for-a-pylons-project-project

--steve



On 5/6/16 at 6:41 PM, vincent.fero...@gmail.com (Vincent Férotin) pronounced:

I totally agree, Steve, that there is much more to explore with
py.test than simple invocation we describe here. And I better
understand how you come to the pattern ``py.test mymodule/mytests.py
-q``. My experience took an other path, where I was sure that using
``py.test`` alone should work, googled about it, and found
configuration i purposed here ;-)

@all:
Anyway, I rework previous patch to meet Michael preferences, and it is
now simpler: just adding tow new file to each scaffold (one for
`pytest`, the other for `coverage`). I also update narrative doc. to
first use simple ``py.test -q`` call (letting a reference to the more
explicit ``py.test mymodule/mytests.py -q`` pattern).

The bad news is that I simply failed to create a PR, in that pushing
new commits to 1.7-branch of my forked repo. aborts (with a
[french/here translated] message like:
" ! [rejected]        1.7-branch -> 1.7-branch (non-fast-forward)
error: unable to push references to
'https://github.com/vincent-ferotin/pyramid.git'
astuce: Update failed due to branch head is behind
astuce: its distant homologue.
astuce: Pull distant changes (e.g. 'git pull ...')
astuce: before pushing. [...]").

I'm not familiar enough with git to resolve this issue.
So I push patches here: https://github.com/vincent-ferotin/pyramid-patches
Patches could be imported by StackedGit (`stg`) through ``stg import
--series pyramid-patches/series``).

I'm sorry about that, and hope this will not abort insert of these
changes in Pyramid's repo.

-- Vincent

2016-05-06 17:52 GMT+02:00 Steve Piercy <steve.piercy....@gmail.com>:
In this case, py.test was totally new to me.  I had always used ``nose`` or
``tox`` that someone else wrote or setup.py'ed for me.  I was a beginner to
py.test and test discoverability.

When I tried running tests out of the box following that pattern via
``py.test``, it didn't work.  Hmm, I thought, there *must* be some way to
make it work.  So I Google Fu'd, visited the link[1] to read about test
discovery, and it became clear in my mind how to do so.  I then wrote the
documentation for how to run tests for the scaffold.  As a beginner, I
managed to work it out.

Because I learned something from this process, I think it is good for
beginners to realize that there is more to py.test than its mere invocation
without options.  There's a lot to explore.  After having this discussion, I
think I should add this reference to the tutorial installation step.

For what it's worth, when we go deeper into tests, we use the simple
invocation with a single option to suppress output, ``py.test -q``.[2]

[1] http://pytest.org/latest/goodpractices.html#python-test-discovery
[2]

http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/tutorials/wiki2/
tests.html#running-the-tests

--steve


On 5/6/16 at 2:51 PM, vincent.fero...@gmail.com (Vincent Férotin)
pronounced:


Thank you, Michael and Steve, for the quick responses.

I will open a PR on github with changes to take in consideration what you
said.

@Steve:
Sure you can explicitly tell py.test to run a specific test module,
but the whole point of my suggestion is to not pass test module path
to py.test. It's the point of view of a beginner, not familiar with
Pyramid scaffolds nor py.test: isn't it easier/more convenient to only
run ``py.test`` at project's root directory, just after project
creation by scaffold, and get all tests collected by default?

-- Vincent

2016-05-05 19:46 GMT+02:00 Steve Piercy <steve.piercy....@gmail.com>:

On 5/5/16 at 9:44 AM, vincent.fero...@gmail.com (Vincent Férotin)
pronounced:

scaffolds are not ready for naive usage of py.test by new comers to
Pyramid,
i.e. running ``py.test [--cov]`` at new project's root collects no
tests.



You are correct in that one cannot just naïvely run:

$ py.test [--cov]

py.test discovers tests in the following manner:
http://pytest.org/latest/goodpractices.html#python-test-discovery

By following the instructions for the SQLAlchemy + URL dispatch wiki
tutorial to get started:



http://docs.pylonsproject.org/projects/pyramid/en/1.7-branch/tutorials/wiki2/
installation.html


I can run the tests:

stevepi-mbp:tutorial stevepiercy$ $VENV/bin/py.test tutorial/tests.py -q
..
2 passed in 0.54 seconds

stevepi-mbp:tutorial stevepiercy$ $VENV/bin/py.test --cov=tutorial
--cov-report=term-missing tutorial/tests.py
=======================================================================
test
session starts
========================================================================
platform darwin -- Python 3.5.0, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /Users/stevepiercy/pyramidtut/tutorial, inifile:
plugins: cov-2.2.1
collected 2 items

tutorial/tests.py ..
--------------------------------------------------------- coverage:
platform
darwin, python 3.5.0-final-0
----------------------------------------------------------
Name                               Stmts   Miss  Cover   Missing
----------------------------------------------------------------
tutorial/__init__.py                   8      6    25%   7-12
tutorial/models/__init__.py           22      0   100%
tutorial/models/meta.py                5      0   100%
tutorial/models/mymodel.py             8      0   100%
tutorial/routes.py                     3      3     0%   1-3
tutorial/scripts/__init__.py           0      0   100%
tutorial/scripts/initializedb.py      26     26     0%   1-45
tutorial/tests.py                     39      0   100%
tutorial/views/__init__.py             0      0   100%
tutorial/views/default.py             12      0   100%
tutorial/views/notfound.py             4      4     0%   1-7
----------------------------------------------------------------
TOTAL                                127     39    69%

===================================================================== 2
passed in 0.57 seconds
=====================================================================
stevepi-mbp:tutorial stevepiercy$

--steve

------------------------
Steve Piercy, Soquel, CA


--
You received this message because you are subscribed to the Google Groups
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.



------------------------
Steve Piercy, Soquel, CA

--
You received this message because you are subscribed to the Google Groups
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.


------------------------
Steve Piercy, Soquel, CA

--
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-devel+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/pylons-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to