Skip to content

docs warnings as errors and initial page similar to README #1848

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

Merged
merged 1 commit into from
Aug 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ env:
- TESTENV=py27-nobyte
- TESTENV=doctesting
- TESTENV=freeze
- TESTENV=docs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


script: tox --recreate -e $TESTENV

Expand Down
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ To execute it::

$ pytest
======= test session starts ========
platform linux -- Python 3.4.3, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
collected 1 items

test_sample.py F
Expand All @@ -52,7 +51,7 @@ To execute it::
======= 1 failed in 0.12 seconds ========


Due to ``py.test``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <http://docs.pytest.org/en/latest/getting-started.html#our-first-test-run>`_ for more examples.
Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <http://docs.pytest.org/en/latest/getting-started.html#our-first-test-run>`_ for more examples.


Features
Expand All @@ -64,7 +63,7 @@ Features
<http://docs.pytest.org/en/latest/goodpractices.html#python-test-discovery>`_
of test modules and functions;

- `Modular fixtures <http://docs.pytest.org/en/latest/fixture.html>`_ for
- `Modular fixtures <http://docs.pytest.org/en/latest/fixture.html>`_ for
managing small or parametrized long-lived test resources;

- Can run `unittest <http://docs.pytest.org/en/latest/unittest.html>`_ (or trial),
Expand Down
27 changes: 11 additions & 16 deletions _pytest/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,31 +711,26 @@ class Metafunc(fixtures.FuncargnamesCompatAttr):
They help to inspect a test function and to generate tests according to
test configuration or values specified in the class or module where a
test function is defined.

:ivar fixturenames: set of fixture names required by the test function

:ivar function: underlying python test function

:ivar cls: class object where the test function is defined in or ``None``.

:ivar module: the module object where the test function is defined in.

:ivar config: access to the :class:`_pytest.config.Config` object for the
test session.

:ivar funcargnames:
.. deprecated:: 2.3
Use ``fixturenames`` instead.
"""
def __init__(self, function, fixtureinfo, config, cls=None, module=None):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change from docstring to inline comments because of sphinx-doc/sphinx#2549. 😞

#: access to the :class:`_pytest.config.Config` object for the test session
self.config = config

#: the module object where the test function is defined in.
self.module = module

#: underlying python test function
self.function = function

#: set of fixture names required by the test function
self.fixturenames = fixtureinfo.names_closure
self._arg2fixturedefs = fixtureinfo.name2fixturedefs

#: class object where the test function is defined in or ``None``.
self.cls = cls

self._calls = []
self._ids = py.builtin.set()
self._arg2fixturedefs = fixtureinfo.name2fixturedefs

def parametrize(self, argnames, argvalues, indirect=False, ids=None,
scope=None):
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ environment:
# builds timing out in AppVeyor
- TOXENV: "linting,py26,py27,py33,py34,py35,pypy"
- TOXENV: "py27-pexpect,py27-xdist,py27-trial,py35-pexpect,py35-xdist,py35-trial"
- TOXENV: "py27-nobyte,doctesting,freeze"
- TOXENV: "py27-nobyte,doctesting,freeze,docs"

install:
- echo Installed Pythons
Expand Down
4 changes: 4 additions & 0 deletions doc/en/adopt.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
:orphan:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to add a comment:

From the sphinx docs:

If set, warnings about this file not being included in any toctree will be suppressed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem


.. warnings about this file not being included in any toctree will be suppressed by :orphan:


April 2015 is "adopt pytest month"
=============================================
Expand Down
2 changes: 2 additions & 0 deletions doc/en/announce/release-2.9.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ The py.test Development Team
.. _#649: https://github.com/pytest-dev/pytest/issues/649

.. _@asottile: https://github.com/asottile
.. _@nicoddemus: https://github.com/nicoddemus
.. _@tomviner: https://github.com/tomviner
7 changes: 6 additions & 1 deletion doc/en/announce/release-2.9.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,10 @@ The py.test Development Team
.. _#1496: https://github.com/pytest-dev/pytest/issue/1496
.. _#1524: https://github.com/pytest-dev/pytest/issue/1524

.. _@prusse-martin: https://github.com/prusse-martin
.. _@astraw38: https://github.com/astraw38
.. _@hackebrot: https://github.com/hackebrot
.. _@omarkohl: https://github.com/omarkohl
.. _@pquentin: https://github.com/pquentin
.. _@prusse-martin: https://github.com/prusse-martin
.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt
.. _@tomviner: https://github.com/tomviner
2 changes: 0 additions & 2 deletions doc/en/announce/sprint2016.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ Over 20 participants took part from 4 continents, including employees
from Splunk, Personalkollen, Cobe.io, FanDuel and Dolby. Some newcomers
mixed with developers who have worked on pytest since its beginning, and
of course everyone in between.
Ana Ribeiro, Brazil
Ronny Pfannschmidt, Germany

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where did we go ^^

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was decided to remove the entire participants list at some point, but those two names seem to be have left by accident (they were a syntax error in Sphinx)


Sprint organisation, schedule
Expand Down
1 change: 1 addition & 0 deletions doc/en/assert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ It is possible to add your own detailed explanations by implementing
the ``pytest_assertrepr_compare`` hook.

.. autofunction:: _pytest.hookspec.pytest_assertrepr_compare
:noindex:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this caused a warning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because it had the same directive elsewhere and Sphinx complained about which one to add to its main index.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, fair enough


As an example consider adding the following hook in a conftest.py which
provides an alternative explanation for ``Foo`` objects::
Expand Down
4 changes: 2 additions & 2 deletions doc/en/builtin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ Fixtures and requests

To mark a fixture function:

.. autofunction:: _pytest.python.fixture
.. autofunction:: _pytest.fixtures.fixture

Tutorial at :ref:`fixtures`.

The ``request`` object that can be used from fixture functions.

.. autoclass:: _pytest.python.FixtureRequest()
.. autoclass:: _pytest.fixtures.FixtureRequest()
:members:


Expand Down
4 changes: 2 additions & 2 deletions doc/en/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = None
html_title = 'pytest documentation'

# A shorter title for the navigation bar. Default is the same as html_title.
html_short_title = "pytest-%s" % release
Expand All @@ -144,7 +144,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# html_static_path = ['_static']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this anymore?

Copy link
Member Author

@nicoddemus nicoddemus Aug 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no _static directory so it was generating a warning.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, cool


# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down
29 changes: 24 additions & 5 deletions doc/en/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,51 @@ Full pytest documentation
.. toctree::
:maxdepth: 2

overview
apiref
example/index
getting-started
Copy link
Member Author

@nicoddemus nicoddemus Aug 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added all files which were not in any table of contents here (#1112), and suggestions on how to order these topics are welcome.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i recall @pfctdayelise working on the structure, perhaps we can use the pictures and merge the docs branch

also how far are those appart

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, I thought they meant a complete overhaul of the docs, including rewriting sections. Here I was interested in getting zero warnings, and to do that I had to include all documents in the table of contents, but which is something we already had agreed would be for the best (flat better than nested, etc)

usage
assert
builtin
fixture
monkeypatch
tmpdir
capture
recwarn
doctest
mark
skipping
parametrize
cache
plugins
unittest
nose
xunit_setup
plugins
writing_plugins

example/index
goodpractices
customize
bash-completion

backwards-compatibility
license
contributing
talks
projects
faq
contact

.. only:: html

.. toctree::
:maxdepth: 1

funcarg_compare
announce/index

.. only:: html

.. toctree::
:hidden:
:maxdepth: 1

changelog

1 change: 1 addition & 0 deletions doc/en/doctest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ from docstrings in all python modules (including regular
python test modules)::

pytest --doctest-modules

You can make these changes permanent in your project by
putting them into a pytest.ini file like this:

Expand Down
6 changes: 2 additions & 4 deletions doc/en/example/reportingdemo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ Demo of Python failure reports with pytest
Here is a nice run of several tens of failures
and how ``pytest`` presents things (unfortunately
not showing the nice colors here in the HTML that you
get on the terminal - we are working on that):
get on the terminal - we are working on that)::

.. code-block:: python

assertion $ pytest failure_demo.py
$ pytest failure_demo.py
======= test session starts ========
platform linux -- Python 3.5.2, pytest-3.0.1, py-1.4.31, pluggy-0.3.1
rootdir: $REGENDOC_TMPDIR/assertion, inifile:
Expand Down
Loading