Rename pytest executable into logilab-pytest

Closes #8396846.

authorDenis Laxalde <denis.laxalde@logilab.fr>
changeset2936f44eed48
branchdefault
phasepublic
hiddenno
parent revision#a46185f35ce7 [testlib] Deprecate with_tempdir (Closes #8267966)
child revision#f3c053de3a0a Deprecate logilab-pytest
files modified by this revision
ChangeLog
MANIFEST.in
README
__pkginfo__.py
bin/logilab-pytest
bin/logilab-pytest.bat
bin/pytest
bin/pytest.bat
debian/python-logilab-common.manpages
debian/rules
doc/logilab-pytest.1
doc/pytest.1
logilab/common/pytest.py
test/data/__pkginfo__.py
tox.ini
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1475478222 -7200
# Mon Oct 03 09:03:42 2016 +0200
# Node ID 2936f44eed48c5d8a0f385e70a9bf4e20ae80450
# Parent a46185f35ce7cf79a19ed9cc2b91ae93c5327bc5
Rename pytest executable into logilab-pytest

Closes #8396846.

diff --git a/ChangeLog b/ChangeLog
@@ -1,8 +1,13 @@
1  ChangeLog for logilab.common
2  ============================
3 
4 +2016-10-03  -- 1.3.0
5 +
6 +    * pytest: executable renamed as logilab-pytest to prevent conflict with
7 +    pytest provided by http://pytest.org/
8 +
9  2016-03-15  -- 1.2.0
10 
11      * pytest: TraceController class, pause_tracing and resume_tracing
12        functions, deprecated from 0.63.1, got removed.  The nocoverage
13        and pause_trace utilities are now available from the testlib
diff --git a/MANIFEST.in b/MANIFEST.in
@@ -1,14 +1,14 @@
14  include ChangeLog
15  include README*
16  include COPYING
17  include COPYING.LESSER
18 -include bin/pytest
19 -include bin/pytest.bat
20 +include bin/logilab-pytest
21 +include bin/logilab-pytest.bat
22  include test/data/ChangeLog
23  recursive-include test *.py *.txt *.msg *.ini *.zip *.egg
24  recursive-include test/data/*_dir *
25  recursive-include test/input *.py
26  recursive-include doc/html *
27 -include doc/pytest.1
28 +include doc/logilab-pytest.1
29  include doc/makefile
30  include __pkginfo__.py
diff --git a/README b/README
@@ -123,11 +123,11 @@
31 
32  Those `logilab.common` modules will much probably be deprecated in future
33  versions:
34 
35  * `testlib`: use `unittest2`_ instead
36 -* `pytest`: use `discover`_ instead
37 +* `logilab-pytest`: use `discover`_ instead
38  * `interface`: use `zope.interface`_ if you really want this
39  * `table`, `xmlutils`: is that used?
40  * `sphinxutils`: we won't go that way imo (i == syt)
41 
42 
diff --git a/__pkginfo__.py b/__pkginfo__.py
@@ -35,11 +35,11 @@
43  author = "Logilab"
44  author_email = "contact@logilab.fr"
45 
46 
47  from os.path import join
48 -scripts = [join('bin', 'pytest')]
49 +scripts = [join('bin', 'logilab-pytest')]
50  include_dirs = [join('test', 'data')]
51 
52  install_requires = [
53      'setuptools',
54      'six >= 1.4.0',
diff --git a/bin/pytest b/bin/logilab-pytest
diff --git a/bin/pytest.bat b/bin/logilab-pytest.bat
diff --git a/debian/python-logilab-common.manpages b/debian/python-logilab-common.manpages
@@ -1,1 +1,1 @@
55 -doc/pytest.1
56 +doc/logilab-pytest.1
diff --git a/debian/rules b/debian/rules
@@ -48,16 +48,16 @@
57  	                --root=$(CURDIR)/debian/$(PACKAGE3)/ \
58  	                ${py_setup_install_args}
59  	# remove test directory
60  	rm -rf debian/$(PACKAGE3)/$(PYLIB3)/logilab/common/test
61 
62 -	# rename pytest and its man page for python3k
63 -	mv debian/$(PACKAGE3)/usr/bin/pytest debian/$(PACKAGE3)/usr/bin/pytest3
64 -	sed -i 's/python -u/python3 -u/' debian/$(PACKAGE3)/usr/bin/pytest3
65 -	install -D doc/pytest.1 debian/$(PACKAGE3)/usr/share/man/man1/pytest3.1
66 -	sed -i 's/pytest/pytest3/' debian/$(PACKAGE3)/usr/share/man/man1/pytest3.1
67 -	gzip debian/$(PACKAGE3)/usr/share/man/man1/pytest3.1
68 +	# rename logilab-pytest and its man page for python3k
69 +	mv debian/$(PACKAGE3)/usr/bin/logilab-pytest debian/$(PACKAGE3)/usr/bin/logilab-pytest3
70 +	sed -i 's/python -u/python3 -u/' debian/$(PACKAGE3)/usr/bin/logilab-pytest3
71 +	install -D doc/logilab-pytest.1 debian/$(PACKAGE3)/usr/share/man/man1/logilab-pytest3.1
72 +	sed -i 's/logilab-pytest/logilab-pytest3/' debian/$(PACKAGE3)/usr/share/man/man1/logilab-pytest3.1
73 +	gzip debian/$(PACKAGE3)/usr/share/man/man1/logilab-pytest3.1
74  endif
75 
76  override_dh_installdocs:
77  	dh_installdocs README*
78  ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
@@ -67,16 +67,16 @@
79  override_dh_auto_test:
80  ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
81  	python setup.py install \
82                  --root=$(CURDIR)/testing/ ${py_setup_install_args}
83  	echo 'import site, os.path; site.addsitedir(os.path.dirname(__file__))' > testing/$(PYLIB)/sitecustomize.py
84 -	PYTHONPATH=$(CURDIR)/testing/$(PYLIB) python bin/pytest -t $(CURDIR)/test
85 +	PYTHONPATH=$(CURDIR)/testing/$(PYLIB) python -m logilab.common.pytest -t $(CURDIR)/test
86  ifneq (,$(build_py3k))
87  	python3 setup.py install \
88  		--root=$(CURDIR)/testing/ ${py_setup_install_args}
89  	echo 'import site, os.path; site.addsitedir(os.path.dirname(__file__))' > testing/$(PYLIB3)/sitecustomize.py
90 -	PYTHONPATH=$(CURDIR)/testing/$(PYLIB3) python3 bin/pytest -t $(CURDIR)/test
91 +	PYTHONPATH=$(CURDIR)/testing/$(PYLIB3) python3 logilab.common.pytest -t $(CURDIR)/test
92  endif
93  endif
94 
95  override_dh_compress:
96  	dh_compress -X.py -X.ini -X.xml -Xtest/ -Xapidoc/
diff --git a/doc/pytest.1 b/doc/logilab-pytest.1
@@ -1,23 +1,23 @@
97 -.TH pytest "1" "January 2008" pytest
98 +.TH logilab-pytest "1" "January 2008" logilab-pytest
99  .SH NAME
100 -.B pytest 
101 +.B logilab-pytest
102  \- run python unit tests
103 
104  .SH SYNOPSIS
105 -usage: pytest [OPTIONS] [testfile [testpattern]]
106 +usage: logilab-pytest [OPTIONS] [testfile [testpattern]]
107  .PP
108  examples:
109  .PP
110 -pytest path/to/mytests.py
111 -pytest path/to/mytests.py TheseTests
112 -pytest path/to/mytests.py TheseTests.test_thisone
113 +logilab-pytest path/to/mytests.py
114 +logilab-pytest path/to/mytests.py TheseTests
115 +logilab-pytest path/to/mytests.py TheseTests.test_thisone
116  .PP
117 -pytest one (will run both test_thisone and test_thatone)
118 -pytest path/to/mytests.py \fB\-s\fR not (will skip test_notthisone)
119 +logilab-pytest one (will run both test_thisone and test_thatone)
120 +logilab-pytest path/to/mytests.py \fB\-s\fR not (will skip test_notthisone)
121  .PP
122 -pytest \fB\-\-coverage\fR test_foo.py
123 +logilab-pytest \fB\-\-coverage\fR test_foo.py
124  .IP
125  (only if logilab.devtools is available)
126  .SS "options:"
127  .TP
128  \fB\-h\fR, \fB\-\-help\fR
@@ -35,11 +35,11 @@
129  \fB\-i\fR, \fB\-\-pdb\fR
130  Enable test failure inspection (conflicts with
131  \fB\-\-coverage\fR)
132  .TP
133  \fB\-x\fR, \fB\-\-exitfirst\fR
134 -Exit on first failure (only make sense when pytest run
135 +Exit on first failure (only make sense when logilab-pytest run
136  one test file)
137  .TP
138  \fB\-s\fR SKIPPED, \fB\-\-skip\fR=\fISKIPPED\fR
139  test names matching this name will be skipped to skip
140  several patterns, use commas
diff --git a/logilab/common/pytest.py b/logilab/common/pytest.py
@@ -13,28 +13,28 @@
141  # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
142  # details.
143  #
144  # You should have received a copy of the GNU Lesser General Public License along
145  # with logilab-common.  If not, see <http://www.gnu.org/licenses/>.
146 -"""pytest is a tool that eases test running and debugging.
147 +"""logilab-pytest is a tool that eases test running and debugging.
148 
149 -To be able to use pytest, you should either write tests using
150 +To be able to use logilab-pytest, you should either write tests using
151  the logilab.common.testlib's framework or the unittest module of the
152  Python's standard library.
153 
154 -You can customize pytest's behaviour by defining a ``pytestconf.py`` file
155 -somewhere in your test directory. In this file, you can add options or
156 +You can customize logilab-pytest's behaviour by defining a ``pytestconf.py``
157 +file somewhere in your test directory. In this file, you can add options or
158  change the way tests are run.
159 
160  To add command line options, you must define a ``update_parser`` function in
161  your ``pytestconf.py`` file. The function must accept a single parameter
162  that will be the OptionParser's instance to customize.
163 
164  If you wish to customize the tester, you'll have to define a class named
165  ``CustomPyTester``. This class should extend the default `PyTester` class
166 -defined in the pytest module. Take a look at the `PyTester` and `DjangoTester`
167 -classes for more information about what can be done.
168 +defined in the logilab.common.pytest module. Take a look at the `PyTester` and
169 +`DjangoTester` classes for more information about what can be done.
170 
171  For instance, if you wish to add a custom -l option to specify a loglevel, you
172  could define the following ``pytestconf.py`` file ::
173 
174      import logging
@@ -99,17 +99,17 @@
175 
176  PYTEST_DOC = """%prog [OPTIONS] [testfile [testpattern]]
177 
178  examples:
179 
180 -pytest path/to/mytests.py
181 -pytest path/to/mytests.py TheseTests
182 -pytest path/to/mytests.py TheseTests.test_thisone
183 -pytest path/to/mytests.py -m '(not long and database) or regr'
184 +logilab-pytest path/to/mytests.py
185 +logilab-pytest path/to/mytests.py TheseTests
186 +logilab-pytest path/to/mytests.py TheseTests.test_thisone
187 +logilab-pytest path/to/mytests.py -m '(not long and database) or regr'
188 
189 -pytest one (will run both test_thisone and test_thatone)
190 -pytest path/to/mytests.py -s not (will skip test_notthisone)
191 +logilab-pytest one (will run both test_thisone and test_thatone)
192 +logilab-pytest path/to/mytests.py -s not (will skip test_notthisone)
193  """
194 
195  ENABLE_DBC = False
196  FILE_RESTART = ".pytest.restart"
197 
@@ -556,25 +556,25 @@
198 
199      def capture_and_rebuild(option, opt, value, parser):
200          warnings.simplefilter('ignore', DeprecationWarning)
201          rebuild_cmdline(option, opt, value, parser)
202 
203 -    # pytest options
204 +    # logilab-pytest options
205      parser.add_option('-t', dest='testdir', default=None,
206                        help="directory where the tests will be found")
207      parser.add_option('-d', dest='dbc', default=False,
208                        action="store_true", help="enable design-by-contract")
209 -    # unittest_main options provided and passed through pytest
210 +    # unittest_main options provided and passed through logilab-pytest
211      parser.add_option('-v', '--verbose', callback=rebuild_cmdline,
212                        action="callback", help="Verbose output")
213      parser.add_option('-i', '--pdb', callback=rebuild_and_store,
214                        dest="pdb", action="callback",
215                        help="Enable test failure inspection")
216      parser.add_option('-x', '--exitfirst', callback=rebuild_and_store,
217                        dest="exitfirst", default=False,
218                        action="callback", help="Exit on first failure "
219 -                      "(only make sense when pytest run one test file)")
220 +                      "(only make sense when logilab-pytest run one test file)")
221      parser.add_option('-R', '--restart', callback=rebuild_and_store,
222                        dest="restart", default=False,
223                        action="callback",
224                        help="Restart tests from where it failed (implies exitfirst) "
225                          "(only make sense if tests previously ran with exitfirst only)")
@@ -596,11 +596,11 @@
226                        help="only execute test whose tag match the current pattern")
227 
228      if DJANGO_FOUND:
229          parser.add_option('-J', '--django', dest='django', default=False,
230                            action="store_true",
231 -                          help='use pytest for django test cases')
232 +                          help='use logilab-pytest for django test cases')
233      return parser
234 
235 
236  def parseargs(parser):
237      """Parse the command line and return (options processed), (options to pass to
diff --git a/test/data/__pkginfo__.py b/test/data/__pkginfo__.py
@@ -35,11 +35,11 @@
238  author = "Logilab"
239  author_email = "contact@logilab.fr"
240 
241 
242  from os.path import join
243 -scripts = [join('bin', 'pytest')]
244 +scripts = [join('bin', 'logilab-pytest')]
245  include_dirs = [join('test', 'data')]
246 
247  install_requires = [
248          'six >= 1.4.0',
249          ]
diff --git a/tox.ini b/tox.ini
@@ -3,6 +3,7 @@
250 
251  [testenv]
252  deps =
253    pytz
254    py27: egenix-mx-base
255 -commands=pytest -t test {posargs}
256 +commands=
257 +  logilab-pytest -t test {posargs}