<!DOCTYPE html>
<html>
<head>
</head>
<body style='font: 12pt Roboto, "DejaVu Sans", Arial; margin-left: 5px; margin-right: 5px;'>
<div id="entry">
<h1 style='font: 12pt Roboto, "DejaVu Sans", Arial; display:block; background: #c0cf88; border-bottom: solid 3px #573; padding: 5px; margin-top: 0px; color: #573;'><a href="https://kallithea-scm.org/repos/kallithea/changeset/ff1bd1b6073692552336e7013c49f3ac0701d8d1" style="text-decoration: none; font-weight: bold; color: #573;">tests: remove duplicate import of 'logging'</a></h1>
<div id="body">
patrickdp committed on 2016-02-09 16:54:22<br />branch: default<br />changeset: <a href="https://kallithea-scm.org/repos/kallithea/changeset/ff1bd1b6073692552336e7013c49f3ac0701d8d1">ff1bd1b6</a><pre>tests: remove duplicate import of 'logging'
M kallithea/tests/__init__.py (0 lines added, 2 lines removed)</pre>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body style='font: 12pt Roboto, "DejaVu Sans", Arial; margin-left: 5px; margin-right: 5px;'>
<div id="entry">
<h1 style='font: 12pt Roboto, "DejaVu Sans", Arial; display:block; background: #c0cf88; border-bottom: solid 3px #573; padding: 5px; margin-top: 0px; color: #573;'><a href="https://kallithea-scm.org/repos/kallithea/changeset/37d713674f63f299515fa26a44cee6766fa416a6" style="text-decoration: none; font-weight: bold; color: #573;">tests: move remove_all_notifications outside of BaseTestCase In preparation of allowing real pytest-style test cases (instead of unittest-style ones), some ...</a></h1>
<div id="body">
patrickdp committed on 2016-02-09 16:51:09<br />branch: default<br />changeset: <a href="https://kallithea-scm.org/repos/kallithea/changeset/37d713674f63f299515fa26a44cee6766fa416a6">37d71367</a><pre>tests: move remove_all_notifications outside of BaseTestCase
In preparation of allowing real pytest-style test cases (instead of
unittest-style ones), some reorganization is needed in the base test
classes, for one because we want a transition period where pytest and
unittest style test cases can live alongside each other, and secondly
because the pytest style test classes cannot have an __init__ method.
The BaseTestCase class will not be reused for the pytest test cases, but
the remove_all_notifications method will. To avoid having to duplicate it,
and since it does not use any resources from the class (self), move the
method out of the BaseTestCase class to top-level, and export it in
kallithea.tests.
M kallithea/tests/__init__.py (9 lines added, 8 lines removed)
M kallithea/tests/functional/test_admin_notifications.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_changeset_comments.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_login.py (1 lines added, 1 lines removed)
M kallithea/tests/models/test_notifications.py (1 lines added, 1 lines removed)</pre>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body style='font: 12pt Roboto, "DejaVu Sans", Arial; margin-left: 5px; margin-right: 5px;'>
<div id="entry">
<h1 style='font: 12pt Roboto, "DejaVu Sans", Arial; display:block; background: #c0cf88; border-bottom: solid 3px #573; padding: 5px; margin-top: 0px; color: #573;'><a href="https://kallithea-scm.org/repos/kallithea/changeset/2cc8d876d1c8806a7e5dea9df2a9c37ab278f047" style="text-decoration: none; font-weight: bold; color: #573;">tests: summary: fix inter-test dependency Test test_index_trending depended on previous actions performed by the test test_index_statistics. Such inter-test...</a></h1>
<div id="body">
patrickdp committed on 2016-02-11 11:13:50<br />branch: default<br />changeset: <a href="https://kallithea-scm.org/repos/kallithea/changeset/2cc8d876d1c8806a7e5dea9df2a9c37ab278f047">2cc8d876</a><pre>tests: summary: fix inter-test dependency
Test test_index_trending depended on previous actions performed by the test
test_index_statistics. Such inter-test dependencies should not be present.
This would become a problem when converting the test class to pytest-style,
because the app is recreated for each test, while the original
TestController creates it once per class.
M kallithea/tests/functional/test_summary.py (6 lines added, 0 lines removed)</pre>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body style='font: 12pt Roboto, "DejaVu Sans", Arial; margin-left: 5px; margin-right: 5px;'>
<div id="entry">
<h1 style='font: 12pt Roboto, "DejaVu Sans", Arial; display:block; background: #c0cf88; border-bottom: solid 3px #573; padding: 5px; margin-top: 0px; color: #573;'><a href="https://kallithea-scm.org/repos/kallithea/changeset/877bcf22bf710608f6997164d238e244d52a2c31" style="text-decoration: none; font-weight: bold; color: #573;">pytest migration: introduce TestControllerPytest In order to allow tests to benefit from pytest specific functionality, like fixtures, they can no longer de...</a></h1>
<div id="body">
patrickdp committed on 2016-02-10 17:28:42<br />branch: default<br />changeset: <a href="https://kallithea-scm.org/repos/kallithea/changeset/877bcf22bf710608f6997164d238e244d52a2c31">877bcf22</a><pre>pytest migration: introduce TestControllerPytest
In order to allow tests to benefit from pytest specific functionality, like
fixtures, they can no longer derive from unittest.TestCase. What's more,
while they can derive from any user-defined class, none of the classes
involved (the test class itself nor any of the base classes) can have an
__init__ method.
Converting all tests from unittest-style to pytest-style in one commit is
not realistic. Hence, a more gradual approach is needed.
Most existing test classes derive from TestController, which in turn derives
from BaseTestCase, which derives from unittest.TestCase. Some test classes
derive directly from BaseTestCase.
Supporting both unittest-style and pytest-style from TestController directly
is not possible: pytest-style _cannot_ and unittest-style _must_ derive from
unittest.TestCase. Thus, in any case, an extra level in the class hierarchy
is needed (TestController deriving from Foo and from unittest.TestCase;
pytest-style test classes would then directly derive from Foo).
The requirement that pytest-style test classes cannot have an __init__
method anywhere in the class hierarchy imposes another restriction that
makes it difficult to support both unittest-style and pytest-style test
classes with one class. Any init code needs to be placed in another method
than __init__ and be called explicitly when the test class is initialized.
For unittest-style test classes this would naturally be done with a
setupClass method, but several test classes already use that. Thus, there
would need to be explicit 'super' calls from the test classes. This is
technically possible but not very nice.
A more transparent approach (from the existing test classes point of view),
implemented by this patch, works as follows:
- the implementation of the existing TestController class is now put under
a new class BaseTestController. To accomodate pytest, the __init__ method
is renamed init.
- contrary to the original TestController, BaseTestController does not
derive from BaseTestCase (and neither from unittest.TestCase). Instead,
the 'new' TestController derives both from BaseTestCase, which is
untouched, and from BaseTestController.
- TestController has an __init__ method that calls the base classes'
__init__ methods and the renamed 'init' method of BaseTestController.
- a new class TestControllerPytest is introduced that derives from
BaseTestController but not from BaseTestCase. It uses a pytest fixture to
automatically call the setup functionality previously provided by
BaseTestCase and also calls 'init' on BaseTestController. This means a
little code duplication but is hard to avoid.
The app setup fixture is scoped on the test method, which means that the app
is recreated for every test (unlike for the unittest-style tests where the
app is created per test class). This has the advantage of detecting current
inter-test dependencies and thus improve the health of our test suite. This
in turn is one step closer to allowing parallel test execution.
The unittest-style assert methods (assertEqual, assertIn, ...) do not exist
for pytest-style tests. To avoid having to change all existing test cases
upfront, provide transitional implementations of these methods. The
conversion of the unittest asserts to the pytest/python asserts can happen
gradually over time.
M kallithea/tests/__init__.py (47 lines added, 6 lines removed)</pre>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body style='font: 12pt Roboto, "DejaVu Sans", Arial; margin-left: 5px; margin-right: 5px;'>
<div id="entry">
<h1 style='font: 12pt Roboto, "DejaVu Sans", Arial; display:block; background: #c0cf88; border-bottom: solid 3px #573; padding: 5px; margin-top: 0px; color: #573;'><a href="https://kallithea-scm.org/repos/kallithea/changeset/9211cc7375875440265a7c072ed5acf376d77663" style="text-decoration: none; font-weight: bold; color: #573;">pytest migration: search: use tmpdir fixture instead of 'current dir' The test_empty_search method needs to refer to an existing directory that is guarantee...</a></h1>
<div id="body">
patrickdp committed on 2016-02-10 18:26:22<br />branch: default<br />changeset: <a href="https://kallithea-scm.org/repos/kallithea/changeset/9211cc7375875440265a7c072ed5acf376d77663">9211cc73</a><pre>pytest migration: search: use tmpdir fixture instead of 'current dir'
The test_empty_search method needs to refer to an existing directory that is
guaranteed to not contain a search index. The current implementation chose
the 'current' directory '.' but it is more of a hack than careful planning.
A temporary empty directory would be cleaner but was more involved to
create.
With the introduction of pytest-style test classes, this can very easily
be improved. Creating a temporary directory with pytest is as simple as
accepting the magic 'tmpdir' argument to the test method. This 'tmpdir' is
a fixture provided by pytest. The variable is initialized with a
py.path.local object referring a temporary directory. For details, see:
<a href="http://pytest.org/latest/tmpdir.html">http://pytest.org/latest/tmpdir.html</a>
M kallithea/tests/functional/test_search.py (3 lines added, 3 lines removed)</pre>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body style='font: 12pt Roboto, "DejaVu Sans", Arial; margin-left: 5px; margin-right: 5px;'>
<div id="entry">
<h1 style='font: 12pt Roboto, "DejaVu Sans", Arial; display:block; background: #c0cf88; border-bottom: solid 3px #573; padding: 5px; margin-top: 0px; color: #573;'><a href="https://kallithea-scm.org/repos/kallithea/changeset/5adc4ad9ce7767fa76a65b4d900550376219734d" style="text-decoration: none; font-weight: bold; color: #573;">pytest migration: convert simple functional tests to TestControllerPytest Replace usage of TestController with TestControllerPytest for those files in tests...</a></h1>
<div id="body">
patrickdp committed on 2016-02-10 17:29:43<br />branch: default<br />changeset: <a href="https://kallithea-scm.org/repos/kallithea/changeset/5adc4ad9ce7767fa76a65b4d900550376219734d">5adc4ad9</a><pre>pytest migration: convert simple functional tests to TestControllerPytest
Replace usage of TestController with TestControllerPytest for those files in
tests/functional where there is no setUp/tearDown method (the pytest
equivalent to be investigated) and that do not use test parametrization.
M kallithea/tests/functional/test_admin_auth_settings.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_admin_defaults.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_admin_permissions.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_admin_repo_groups.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_admin_settings.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_admin_user_groups.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_admin_users.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_branches.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_changelog.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_changeset.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_compare_local.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_feed.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_followers.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_home.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_journal.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_pullrequests.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_repo_groups.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_summary.py (1 lines added, 1 lines removed)
M kallithea/tests/functional/test_tags.py (1 lines added, 1 lines removed)</pre>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body style='font: 12pt Roboto, "DejaVu Sans", Arial; margin-left: 5px; margin-right: 5px;'>
<div id="entry">
<h1 style='font: 12pt Roboto, "DejaVu Sans", Arial; display:block; background: #c0cf88; border-bottom: solid 3px #573; padding: 5px; margin-top: 0px; color: #573;'><a href="https://kallithea-scm.org/repos/kallithea/changeset/6b67bbc1652e63bb07153c74fd51dd9903008270" style="text-decoration: none; font-weight: bold; color: #573;">pytest migration: make pytest's parametrize functionality available To provide parameterized tests, a custom implementation is currently provided at kallith...</a></h1>
<div id="body">
patrickdp committed on 2016-02-10 17:30:13<br />branch: default<br />changeset: <a href="https://kallithea-scm.org/repos/kallithea/changeset/6b67bbc1652e63bb07153c74fd51dd9903008270">6b67bbc1</a><pre>pytest migration: make pytest's parametrize functionality available
To provide parameterized tests, a custom implementation is currently
provided at kallithea/tests/parameterized.py because nose does not provide
that out-of-the-box.
pytest, on the other hand, does have a built-in 'parametrize' (note:
different spelling) functionality. Therefore, once all tests have been
converted to pytest, we can get rid of the custom 'parameterized'
implementation. Also, the existing 'parameterized' implementation does not
seem to work under pytest-style tests.
This commit makes pytest's 'parametrize' decorator available alongside the
custom 'parameterized' decorator. The names are confusing but it is the
intention to kill the original 'parameterized' soon.
M kallithea/tests/__init__.py (2 lines added, 1 lines removed)</pre>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body style='font: 12pt Roboto, "DejaVu Sans", Arial; margin-left: 5px; margin-right: 5px;'>
<div id="entry">
<h1 style='font: 12pt Roboto, "DejaVu Sans", Arial; display:block; background: #c0cf88; border-bottom: solid 3px #573; padding: 5px; margin-top: 0px; color: #573;'><a href="https://kallithea-scm.org/repos/kallithea/changeset/491961dfd0c8d601eacea0b5642ede71f0de7adb" style="text-decoration: none; font-weight: bold; color: #573;">pytest migration: files: convert to TestControllerPytest and parametrize Migrate the 'files' tests to pytest and its parametrize decorator. The syntax of th...</a></h1>
<div id="body">
patrickdp committed on 2016-02-10 17:30:27<br />branch: default<br />tag: tip<br />changeset: <a href="https://kallithea-scm.org/repos/kallithea/changeset/491961dfd0c8d601eacea0b5642ede71f0de7adb">491961df</a><pre>pytest migration: files: convert to TestControllerPytest and parametrize
Migrate the 'files' tests to pytest and its parametrize decorator.
The syntax of this decorator is slightly different: a first argument is a
comma-separated string with the method argument names for which the values
are provided as second argument.
M kallithea/tests/functional/test_files.py (5 lines added, 5 lines removed)</pre>
</div>
</div>
</div>
</body>
</html>