Переглянути джерело

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

tags/v0.6
Ben Kurtovic 5 роки тому
джерело
коміт
b09b619709
5 змінених файлів з 16 додано та 12 видалено
  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 Переглянути файл

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

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

Usage
-----


+ 6
- 4
appveyor.yml Переглянути файл

@@ -13,9 +13,10 @@ environment:
global:
# See: http://stackoverflow.com/a/13751649/163740
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_PASSWORD:
secure: gOIcvPxSC2ujuhwOzwj3v8xjq3CCYd8keFWVnguLM+gcL0e02qshDHy7gwZZwj0+
@@ -67,9 +68,10 @@ install:

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

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

after_test:
- "%SETUPPY% bdist_wheel"


+ 1
- 1
docs/index.rst Переглянути файл

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

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

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


+ 2
- 1
scripts/release.sh Переглянути файл

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


+ 6
- 5
tests/_test_tokenizer.py Переглянути файл

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

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

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

if not data["name"]:
error = "A test in '{0}' was ignored because it lacked a name"
print(error.format(filename))
warnings.warn(error.format(filename))
continue
if data["input"] is None or data["output"] is None:
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

number = str(counter).zfill(digits)


Завантаження…
Відмінити
Зберегти