summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2016-05-07 01:15:52 -0700
committerSteve Piercy <web@stevepiercy.com>2016-05-07 01:15:52 -0700
commit5beb1eb5d29f43c6e958fb92570f0be767a31bab (patch)
tree3979a79a36fef5e736b67a54d04c07b444be4d91
parent7734a3737923c3b1e87c29b76c30f4f39a450dbd (diff)
parente09369f02f61f2443f393bcd29fa84e970268b53 (diff)
downloadpyramid-5beb1eb5d29f43c6e958fb92570f0be767a31bab.tar.gz
pyramid-5beb1eb5d29f43c6e958fb92570f0be767a31bab.tar.bz2
pyramid-5beb1eb5d29f43c6e958fb92570f0be767a31bab.zip
Merge pull request #2549 from stevepiercy/vincent-ferotin-scaffolds-allow-pytest-run-without-args
Vincent ferotin scaffolds allow pytest run without args
-rw-r--r--docs/narr/project.rst26
-rw-r--r--pyramid/scaffolds/alchemy/+dot+coveragerc_tmpl3
-rw-r--r--pyramid/scaffolds/alchemy/pytest.ini_tmpl3
-rw-r--r--pyramid/scaffolds/starter/+dot+coveragerc_tmpl3
-rw-r--r--pyramid/scaffolds/starter/pytest.ini_tmpl3
-rw-r--r--pyramid/scaffolds/zodb/+dot+coveragerc_tmpl3
-rw-r--r--pyramid/scaffolds/zodb/pytest.ini_tmpl3
7 files changed, 41 insertions, 3 deletions
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index 56247ee33..a25394151 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -209,19 +209,19 @@ On UNIX:
.. code-block:: bash
- $ $VENV/bin/py.test myproject/tests.py -q
+ $ $VENV/bin/py.test -q
On Windows:
.. code-block:: doscon
- > %VENV%\Scripts\py.test myproject\tests.py -q
+ > %VENV%\Scripts\py.test -q
Here's sample output from a test run on UNIX:
.. code-block:: bash
- $ $VENV/bin/py.test myproject/tests.py -q
+ $ $VENV/bin/py.test -q
..
2 passed in 0.47 seconds
@@ -235,6 +235,26 @@ only two sample tests exist.
to a stream of dots. If you don't pass ``-q``, you'll see verbose test
result output (which normally isn't very useful).
+Alternatively, if you'd like to see test coverage, pass the ``--cov`` option
+to ``py.test``:
+
+.. code-block:: bash
+
+ $ $VENV/bin/py.test --cov -q
+
+Scaffolds include configuration defaults for ``py.test`` and test coverage.
+These configuration files are ``pytest.ini`` and ``.coveragerc``, located at
+the root of your package. Without these defaults, we would need to specify the
+path to the module on which we want to run tests and coverage.
+
+.. code-block:: bash
+
+ $ $VENV/bin/py.test --cov=myproject myproject/tests.py -q
+
+.. seealso:: See py.test's documentation for :ref:`pytest:usage` or invoke
+ ``py.test -h`` to see its full set of options.
+
+
.. index::
single: running an application
single: pserve
diff --git a/pyramid/scaffolds/alchemy/+dot+coveragerc_tmpl b/pyramid/scaffolds/alchemy/+dot+coveragerc_tmpl
new file mode 100644
index 000000000..273a4a580
--- /dev/null
+++ b/pyramid/scaffolds/alchemy/+dot+coveragerc_tmpl
@@ -0,0 +1,3 @@
+[run]
+source = {{package}}
+omit = {{package}}/test*
diff --git a/pyramid/scaffolds/alchemy/pytest.ini_tmpl b/pyramid/scaffolds/alchemy/pytest.ini_tmpl
new file mode 100644
index 000000000..a30c8bcad
--- /dev/null
+++ b/pyramid/scaffolds/alchemy/pytest.ini_tmpl
@@ -0,0 +1,3 @@
+[pytest]
+testpaths = {{package}}
+python_files = *.py
diff --git a/pyramid/scaffolds/starter/+dot+coveragerc_tmpl b/pyramid/scaffolds/starter/+dot+coveragerc_tmpl
new file mode 100644
index 000000000..273a4a580
--- /dev/null
+++ b/pyramid/scaffolds/starter/+dot+coveragerc_tmpl
@@ -0,0 +1,3 @@
+[run]
+source = {{package}}
+omit = {{package}}/test*
diff --git a/pyramid/scaffolds/starter/pytest.ini_tmpl b/pyramid/scaffolds/starter/pytest.ini_tmpl
new file mode 100644
index 000000000..a30c8bcad
--- /dev/null
+++ b/pyramid/scaffolds/starter/pytest.ini_tmpl
@@ -0,0 +1,3 @@
+[pytest]
+testpaths = {{package}}
+python_files = *.py
diff --git a/pyramid/scaffolds/zodb/+dot+coveragerc_tmpl b/pyramid/scaffolds/zodb/+dot+coveragerc_tmpl
new file mode 100644
index 000000000..273a4a580
--- /dev/null
+++ b/pyramid/scaffolds/zodb/+dot+coveragerc_tmpl
@@ -0,0 +1,3 @@
+[run]
+source = {{package}}
+omit = {{package}}/test*
diff --git a/pyramid/scaffolds/zodb/pytest.ini_tmpl b/pyramid/scaffolds/zodb/pytest.ini_tmpl
new file mode 100644
index 000000000..a30c8bcad
--- /dev/null
+++ b/pyramid/scaffolds/zodb/pytest.ini_tmpl
@@ -0,0 +1,3 @@
+[pytest]
+testpaths = {{package}}
+python_files = *.py