Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44111ed

Browse files
authored
Merge pull requestrealpython#862 from Zac-HD/various
Various cross-references in tests and installation advice
2 parents516f9ad +cb3f026 commit44111ed

File tree

8 files changed

+60
-42
lines changed

8 files changed

+60
-42
lines changed

‎docs/scenarios/ci.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Continuous Integration
33

44
..image::https://farm5.staticflickr.com/4173/33907150594_9abba7ad0a_k_d.jpg
55

6+
..note::
7+
For advice on writing your tests, see:doc:`writing/tests`.
8+
69
Why?
710
----
811

‎docs/starting/install/linux.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Installing Python 2 on Linux
55

66
..image::https://farm5.staticflickr.com/4268/34435688560_4cc2a7bcbb_k_d.jpg
77

8+
..note::
9+
Check out our:ref:`guide for installing Python 3 on Linux<install3-linux>`.
10+
811
The latest versions of CentOS, Red Hat Enterprise Linux (RHEL) and Ubuntu
912
**come with Python 2.7 out of the box**.
1013

‎docs/starting/install/win.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Installing Python 2 on Windows
55

66
..image::https://farm5.staticflickr.com/4268/34435688560_4cc2a7bcbb_k_d.jpg
77

8+
..note::
9+
Check out our:ref:`guide for installing Python 3 on Windows<install3-windows>`.
10+
811
First, download the `latest version<https://www.python.org/ftp/python/2.7.14/python-2.7.14.msi>`_
912
of Python 2.7 from the official website. If you want to be sure you are installing a fully
1013
up-to-date version, click the Downloads > Windows link from the home page of the
@@ -50,24 +53,22 @@ makes it much easier for you to use other third-party Python libraries.
5053
Setuptools + Pip
5154
----------------
5255

53-
The most crucial third-party Python software of all is Setuptools, which
54-
extends the packaging and installation facilities provided by the distutils in
55-
the standard library. Once you add Setuptools to your Python system you can
56-
download and install any compliant Python software product with a single
57-
command. It also enables you to add this network installation capability to
58-
your own Python software with very little work.
56+
The two most crucial third-party Python packages are `setuptools<https://pypi.python.org/pypi/setuptools>`_ and `pip<https://pip.pypa.io/en/stable/>`_.
57+
58+
Once installed, you can download, install and uninstall any compliant Python software
59+
product with a single command. It also enables you to add this network installation
60+
capability to your own Python software with very little work.
5961

60-
To obtain the latest version of Setuptools for Windows, run thePythonscript
61-
available here: `ez_setup.py<https://bootstrap.pypa.io/ez_setup.py>`_
62+
Python 2.7.9 and later (on the python2 series), andPython3.4 and later include
63+
pip by default.
6264

65+
To see if pip is installed, open a command prompt and run
66+
67+
..code-block::console
6368
64-
You'll now have a new command available to you: **easy_install**. It is
65-
considered by many to be deprecated, so we will install its replacement:
66-
**pip**. Pip allows for uninstallation of packages, and is actively maintained,
67-
unlike easy_install.
69+
$ command -v pip
6870
69-
To install pip, run the Python script available here:
70-
`get-pip.py<https://raw.github.com/pypa/pip/master/contrib/get-pip.py>`_
71+
To install pip, `follow the official pip installation guide<https://pip.pypa.io/en/latest/installing/>`_ - this will automatically install the latest version of setuptools.
7172

7273

7374
Virtual Environments

‎docs/starting/install3/win.rst

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,14 @@ This will launch the Python 3 interpreter.
6464
Setuptools + Pip
6565
----------------
6666

67-
The most crucial third-party Python software of all is Setuptools, which
68-
extends the packaging and installation facilities provided by the distutils in
69-
the standard library. Once you add Setuptools to your Python system you can
70-
download and install any compliant Python software product with a single
71-
command. It also enables you to add this network installation capability to
72-
your own Python software with very little work.
67+
The two most crucial third-party Python packages are `setuptools<https://pypi.python.org/pypi/setuptools>`_ and `pip<https://pip.pypa.io/en/stable/>`_,
68+
which let you download, install and uninstall any compliant Python software
69+
product with a single command. It also enables you to add this network installation
70+
capability to your own Python software with very little work.
7371

74-
To obtain the latest version of Setuptools for Windows, run the Python script
75-
available here: `ez_setup.py<https://bootstrap.pypa.io/ez_setup.py>`_
72+
All supported versions of Python 3 include pip, so just make sure it's up to date::
7673

77-
78-
You'll now have a new command available to you: **easy_install**. It is
79-
considered by many to be deprecated, so we will install its replacement:
80-
**pip**. Pip allows for uninstallation of packages, and is actively maintained,
81-
unlike easy_install.
82-
83-
To install pip, run the Python script available here:
84-
`get-pip.py<https://raw.github.com/pypa/pip/master/contrib/get-pip.py>`_
74+
python -m pip install -U pip
8575

8676

8777
Pipenv & Virtual Environments

‎docs/starting/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Installation Guides
2424
These guides go over the proper installation of:ref:`Python<which-python>`
2525
for development purposes, as well as setuptools, pip and virtualenv.
2626

27-
Python 3 Installation Guides
28-
////////////////////////////
27+
Python 3 Installation Guides
28+
////////////////////////////
2929

3030
-:ref:`Python 3 on MacOS<install3-osx>`.
3131
-:ref:`Python 3 on Windows<install3-windows>`.

‎docs/starting/which-python.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ It is possible to `write code that works on Python 2.6, 2.7, and Python 3
5858
<https://docs.python.org/3/howto/pyporting.html>`_. This
5959
ranges from trivial to hard depending upon the kind of software
6060
you are writing; if you're a beginner there are far more important things to
61-
worry about.
61+
worry about. Note that Python 2.6 is end-of-life upstream, so you shouldn't
62+
try to write 2.6-compatible code unless you're being paid specifically to
63+
do that.
6264

6365
Implementations
6466
~~~~~~~~~~~~~~~

‎docs/writing/structure.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ Test Suite
174174
::::::::::
175175

176176

177+
*For advice on writing your tests, see :doc:`writing/tests`.*
178+
177179
..csv-table::
178180
:widths: 20, 40
179181

‎docs/writing/tests.rst

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,38 @@ the unittest module!
190190
`py.test<https://docs.pytest.org/en/latest/>`_
191191

192192

193-
Nose
194-
----
195-
196-
nose extends unittest to make testing easier.
193+
Hypothesis
194+
----------
197195

196+
Hypothesis is a library which lets you write tests that are parametrized by
197+
a source of examples. It then generates simple and comprehensible examples
198+
that make your tests fail, letting you find more bugs with less work.
198199

199200
..code-block::console
200201
201-
$ pip install nose
202+
$ pip install hypothesis
203+
204+
For example, testing lists of floats will try many examples, but report the
205+
minimal example of each bug (distinguished exception type and location):
206+
207+
..code-block::python
208+
209+
@given(lists(floats(allow_nan=False,allow_infinity=False),min_size=1))
210+
deftest_mean(xs):
211+
mean=sum(xs)/len(xs)
212+
assertmin(xs)<= mean(xs)<=max(xs)
213+
214+
..code-block::
215+
216+
Falsifying example: test_mean(
217+
xs=[1.7976321109618856e+308, 6.102390043022755e+303]
218+
)
202219
203-
nose provides automatic test discovery to save you the hassle of manually
204-
creating test suites. It also provides numerous plugins for features such as
205-
xUnit-compatible test output, coverage reporting,andtest selection.
220+
Hypothesis is practical as well as very powerful, and will often find bugs
221+
that escaped all other forms of testing. It integrates well with py.test,
222+
and has a strong focus on usability in both simpleandadvanced scenarios.
206223

207-
`nose<https://nose.readthedocs.io/en/latest/>`_
224+
`hypothesis<https://hypothesis.readthedocs.io/en/latest/>`_
208225

209226

210227
tox

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp