Kaynağa Gözat

Switch to 'unittest discover' over 'setup.py test'

tags/v0.6
Ben Kurtovic 5 yıl önce
ebeveyn
işleme
b09b619709
5 değiştirilmiş dosya ile 16 ekleme ve 12 silme
  1. +1
    -1
      README.rst
  2. +6
    -4
      appveyor.yml
  3. +1
    -1
      docs/index.rst
  4. +2
    -1
      scripts/release.sh
  5. +6
    -5
      tests/_test_tokenizer.py

+ 1
- 1
README.rst Dosyayı Görüntüle

@@ -30,7 +30,7 @@ Alternatively, get the latest development version::
python setup.py install python setup.py install


You can run the comprehensive unit testing suite with You can run the comprehensive unit testing suite with
``python setup.py test -q``.
``python -m unittest discover``.


Usage Usage
----- -----


+ 6
- 4
appveyor.yml Dosyayı Görüntüle

@@ -13,9 +13,10 @@ environment:
global: global:
# See: http://stackoverflow.com/a/13751649/163740 # See: http://stackoverflow.com/a/13751649/163740
WRAPPER: "cmd /E:ON /V:ON /C .\\scripts\\win_wrapper.cmd" WRAPPER: "cmd /E:ON /V:ON /C .\\scripts\\win_wrapper.cmd"
PIP: "%WRAPPER% %PYTHON%\\python.exe -m pip"
SETUPPY: "%WRAPPER% %PYTHON%\\python.exe setup.py --with-extension"
TWINE: "%WRAPPER% %PYTHON%\\python.exe -m twine"
PYEXE: "%WRAPPER% %PYTHON%\\python.exe"
SETUPPY: "%PYEXE% setup.py --with-extension"
PIP: "%PYEXE% -m pip"
TWINE: "%PYEXE% -m twine"
PYPI_USERNAME: "earwigbot" PYPI_USERNAME: "earwigbot"
PYPI_PASSWORD: PYPI_PASSWORD:
secure: gOIcvPxSC2ujuhwOzwj3v8xjq3CCYd8keFWVnguLM+gcL0e02qshDHy7gwZZwj0+ secure: gOIcvPxSC2ujuhwOzwj3v8xjq3CCYd8keFWVnguLM+gcL0e02qshDHy7gwZZwj0+
@@ -67,9 +68,10 @@ install:


build_script: build_script:
- "%SETUPPY% build" - "%SETUPPY% build"
- "%SETUPPY% install --user"


test_script: test_script:
- "%SETUPPY% -q test"
- "%PYEXE% -m unittest discover"


after_test: after_test:
- "%SETUPPY% bdist_wheel" - "%SETUPPY% bdist_wheel"


+ 1
- 1
docs/index.rst Dosyayı Görüntüle

@@ -28,7 +28,7 @@ Alternatively, get the latest development version::
python setup.py install python setup.py install


You can run the comprehensive unit testing suite with You can run the comprehensive unit testing suite with
``python setup.py test -q``.
``python -m unittest discover``.


.. _Python Package Index: https://pypi.org/ .. _Python Package Index: https://pypi.org/
.. _get pip: https://pypi.org/project/pip/ .. _get pip: https://pypi.org/project/pip/


+ 2
- 1
scripts/release.sh Dosyayı Görüntüle

@@ -133,7 +133,8 @@ test_release() {
rm mwparserfromhell.tar.gz mwparserfromhell.tar.gz.asc rm mwparserfromhell.tar.gz mwparserfromhell.tar.gz.asc
cd mwparserfromhell-$VERSION cd mwparserfromhell-$VERSION
echo "Running unit tests..." echo "Running unit tests..."
python setup.py -q test
python setup.py -q install
python -m unittest discover
if [[ "$?" != "0" ]]; then if [[ "$?" != "0" ]]; then
echo "*** ERROR: Unit tests failed!" echo "*** ERROR: Unit tests failed!"
deactivate deactivate


+ 6
- 5
tests/_test_tokenizer.py Dosyayı Görüntüle

@@ -20,10 +20,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.


from __future__ import print_function, unicode_literals
from __future__ import unicode_literals
import codecs import codecs
from os import listdir, path from os import listdir, path
import sys import sys
import warnings


from mwparserfromhell.compat import py3k, str from mwparserfromhell.compat import py3k, str
from mwparserfromhell.parser import tokens from mwparserfromhell.parser import tokens
@@ -98,19 +99,19 @@ class TokenizerTestCase(object):
except _TestParseError as err: except _TestParseError as err:
if data["name"]: if data["name"]:
error = "Could not parse test '{0}' in '{1}':\n\t{2}" error = "Could not parse test '{0}' in '{1}':\n\t{2}"
print(error.format(data["name"], filename, err))
warnings.warn(error.format(data["name"], filename, err))
else: else:
error = "Could not parse a test in '{0}':\n\t{1}" error = "Could not parse a test in '{0}':\n\t{1}"
print(error.format(filename, err))
warnings.warn(error.format(filename, err))
continue continue


if not data["name"]: if not data["name"]:
error = "A test in '{0}' was ignored because it lacked a name" error = "A test in '{0}' was ignored because it lacked a name"
print(error.format(filename))
warnings.warn(error.format(filename))
continue continue
if data["input"] is None or data["output"] is None: if data["input"] is None or data["output"] is None:
error = "Test '{}' in '{}' was ignored because it lacked an input or an output" error = "Test '{}' in '{}' was ignored because it lacked an input or an output"
print(error.format(data["name"], filename))
warnings.warn(error.format(data["name"], filename))
continue continue


number = str(counter).zfill(digits) number = str(counter).zfill(digits)


Yükleniyor…
İptal
Kaydet