|
|
mads
|
5e46f73f0d1c
|
5 years ago
|
|
|
|
|
mads
|
e527cc2ce8dc
|
6 years ago
|
|
cleanup: get rid of most "import *"
Apply script generated with the following hack: ( hg loc '*.py'|xargs pyflakes-2 | sed -rn "s/([^:]*):.*'(.*)' may be undefined, or defined from star imports.*/sed -ri 's,\\\\<\2\\\\>([^=]|$),XXXX.\2\\\\1,g' \1/gp" | sort -u hg loc '*.py'|xargs pyflakes-2 | sed -rn "s/([^:]*):.* undefined name '(.*)'$/sed -ri 's,\\\\<\2\\\\>([^=]|$),XXXX.\2\\\\1,g' \1/gp" | sort -u hg loc '*.py'|xargs pyflakes-2 | sed -rn "s/([^:]*):.*'(from .*)\.([^.]*) import \*' used.*/sed -ri 's,\\\\<XXXX\\\\.,\3.,g' \1/gp" | sort -u hg loc '*.py'|xargs pyflakes-2 | sed -rn "s/([^:]*):.*'(from .*)\.([^.]*) import \*' used.*/sed -ri 's,\2\\\\.\3 .*,\2 import \3,g' \1/gp" | sort -u ) | grep -v kallithea/bin/kallithea_cli_ishell.py > fix2.sh
|
|
|
mads
|
0a277465fddf
|
7 years ago
|
|
|
|
|
Lars Kruse
|
7691290837d2
|
9 years ago
|
|
codingstyle: trivial whitespace fixes
Reported by flake8.
|
|
|
Thomas De Schampheleire
|
8d98924c58b1
|
9 years ago
|
|
tests: add as little code as possible in __init__.py
kallithea/tests/__init__.py contained quite a lot of code, including the test base class TestController. This in itself may be considered bad practice.
Specifically, this poses a problem when using pytest 3.0+, in which asserts in some files are not automatically rewritten to give improved assert output. That problem can be fixed by explicitly registering such files for assertion rewriting, but that register call should be executed _before_ said files are imported. I.e. if the register call is in kallithea/tests/__init__.py, assert calls in __init__.py itself can not be rewritten.
Since the TestController base class does effectively contain asserts, and we do not want to execute the register call from somewhere outside the kallithea/tests directory, we need to move the TestController class to another file (kallithea/tests/base.py) so we can have a register call in __init__.py before loading base.py.
While not strictly necessary to fix the mentioned pytest problem, we take the opportunity to fully clean __init__.py and move everything to the new kallithea/tests/base.py. While doing so, unnecessary imports are removed, and imports are ordered alphabetically. Explicit imports of symbols from modules that were already imported as a whole, are removed in favor of fully qualifying the references (e.g. tempfile._RandomNameSequence).
|
|
|
Thomas De Schampheleire
|
7f2aa3ec2931
|
10 years ago
|
|
pytest migration: rename TestControllerPytest back to TestController
The name TestControllerPytest was introduced to allow a temporary situation where nose/unittest and pytest-based tests could coexist. This situation is now over, so the base test class can be renamed again.
|
|
|
Thomas De Schampheleire
|
7483b3f3bea5
|
10 years ago
|
|
pytest migration: models: switch to standard assert statements Use unittest2pytest to replace unittest-style assert statements (e.g. assertEqual) with standard Python assert statements to benefit from pytest's improved reporting on assert failures. The conversion by unittest2pytest was correct except for: - 'import pytest' is not automatically added when needed - line wrapping in string formatting caused a syntax error in the transformed code. Reported upstream at https://github.com/pytest-dev/unittest2pytest/issues/3 . - in assertRaises with a lambda, the lambda needs to be removed
|
|
|
Thomas De Schampheleire
|
be1d20bfd2dd
|
10 years ago
|
|
pytest migration: model: convert all tests to TestControllerPytest
The model tests were based on BaseTestCase which does not exist currently for pytest-style tests. Nevertheless, there seems to be no advantage of directly subclassing BaseTestCase over subclassing TestControllerPytest. Thus, keep things simple and use TestControllerPytest.
|
|
|
Thomas De Schampheleire
|
481a484b1d69
|
11 years ago
|
|
|
|
|
Thomas De Schampheleire
|
99f090563f5f
|
11 years ago
|
|
changeset status: fix common case where a reviewer did not yet review anything
When a reviewer did not yet make any review, its status for the changeset is None, causing the code to crash. The unit tests also did not cover this case.
|
|
|
Thomas De Schampheleire
|
6b1e1437c026
|
11 years ago
|
|
changeset status: set status to rejected if at least one reviewer rejected
Currently, a reject of a change by a reviewer does not affect the overall status at all. A logical policy is to reject the change if at least one reviewer rejects it.
Note: different repositories/organizations may require different policies for the overall status. Currently, the policies for approve/reject are fixed. A possible improvement is to provide several alternative policies and allow selecting the policy per instance or per repo.
|
|
|
Thomas De Schampheleire
|
36d81185efe4
|
11 years ago
|
|
changeset_status: add unit tests for calculation of overall status
Add unit tests for the calculation of the review status of a changeset/pull request. To allow this, some reorganization of the ChangesetStatusModel is needed.
|