Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-berlin-wmse committed Feb 1, 2024
1 parent 5dc1ada commit c5ca8d6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 45 deletions.
3 changes: 0 additions & 3 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
-r requirements.txt

flake8==6.0.0
isort==5.12.0
tox==4.5.1
yamllint==1.32.0
2 changes: 1 addition & 1 deletion template.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, name, subst=False, parameters=None):
self._subst = subst
if parameters is None:
self._parameters = OrderedDict()
elif type(parameters) == list:
elif isinstance(parameters, list):
self._parameters = {i: p for i, p in enumerate(parameters, 1)}
else:
self._parameters = parameters
Expand Down
48 changes: 11 additions & 37 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,53 +1,27 @@
[tox]
envlist = yaml,flake8,isort,travis
skipsdist=true
env_list = flake8, yaml
no_package = true

[testenv]
setenv =
PYWIKIBOT2_NO_USER_CONFIG = 1
# Since pywikibot fallback to the user home directory:
# Since pywikibot fallback to the user home directory:
HOME={envdir}
deps =
-r{toxinidir}/requirements.txt
commands = nosetests {posargs}
deps = -r requirements-test.txt

[testenv:flake8]
deps = flake8==6.0.0
deps = flake8==7.0.0
commands = flake8

[flake8]
exclude =
.venv,
.tox,
user-config.py,
.venv
.tox
user-config.py
user-password.py
ignore = W503 # line break before binary operator; against current PEP 8

[testenv:isort]
deps = isort==5.12.0
commands =
isort {posargs:--check-only --diff} --recursive --verbose \
--skip .git --skip .tox --skip .venv --skip user-config.py \
--skip user-password.py

[isort]
known_first_party =
known_third_party = mwparserfromhell,wikitables,yaml
known_pywikibot = pywikibot
multi_line_output = 3
sections = FUTURE,STDLIB,THIRDPARTY,PYWIKIBOT,FIRSTPARTY,LOCALFOLDER
# line break before binary operator; against current PEP 8
ignore = W503

[testenv:yaml]
deps = yamllint==1.32.0
commands =
yamllint {toxinidir}/

[testenv:travis] # combined testing to be run per python version
deps =
flake8==3.7.9
isort==4.2.15
yamllint
commands =
flake8
isort --check-only --diff --recursive --skip .tox --skip .git --skip .venv
yamllint {toxinidir}/
commands = yamllint .
5 changes: 1 addition & 4 deletions wiki.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import logging
import re

import mwparserfromhell as mwp
from wikitables.util import ftag

from pywikibot import Page, Site

from const import Components
Expand Down Expand Up @@ -709,9 +706,9 @@ def _insert_row_before_default(self, template, row, number):
template.text
)


class PageMissingError(Exception):
def __init__(self, missing_page):
message = (f"Page '{missing_page}' doesn't exist and is "
"required to create this page.")
super().__init__(message)

0 comments on commit c5ca8d6

Please sign in to comment.