Commit graph

168 commits

Author SHA1 Message Date
Henrik Levkowetz 7f607c51d2 Changed from old-style to new-style middleware.
- Legacy-Id: 12824
2017-02-12 17:07:48 +00:00
Henrik Levkowetz aa5e61d958 Updated all urlpatterns to use ietf.utils.urls.url() instead of django's,
in order to autogenerate dotted path url pattern names.  Updated a number
of url reverses to use dotted path, and removed explicit url pattern names
as needed.

Changed some imports to prevent import of ietf.urls before django
initialization was complete.


Changed 3 cases of form classes being curried to functions; django 1.10
didn't accept that.

Started converting old-style middleware classes to new-style middleware
functions (incomplete).

Tweaked a nomcom decorator to preserve function names and attributes, like
a good decorator should.

Replaced the removed django templatetag 'removetags' with our own version
which uses bleach, and does sanitizing in addition to removing explicitly
mentionied html tags.

Rewrote the filename argument handling in a management command which had
broken with the upgrade.
 - Legacy-Id: 12818
2017-02-11 14:43:01 +00:00
Henrik Levkowetz 40e8380751 Merged django 1.9 work forward to copy of trunk @6.41.0
- Legacy-Id: 12756
2017-01-30 23:13:02 +00:00
Henrik Levkowetz 79c44d25ea Changed settings_sqlitetest so that local developer additions to context processors and middleware classes are avoided.
- Legacy-Id: 12723
2017-01-24 20:42:51 +00:00
Henrik Levkowetz 450c39af23 Changed the failure leeway of the code coverage test percentage from 0.005% back to 0.02%.
- Legacy-Id: 12707
2017-01-19 20:01:19 +00:00
Henrik Levkowetz 3944ab95cc Django 1.9: Supplied a required argument to TemplateDoesNotExist()
- Legacy-Id: 12616
2016-12-22 17:14:51 +00:00
Henrik Levkowetz 65481b5df7 Moved warnings settings from manage.py and test_runner.py to one single place, settings.py. Decreased the verbosity level when invoking 'loaddata' from the test runner.
- Legacy-Id: 12535
2016-12-15 13:25:20 +00:00
Henrik Levkowetz 8e56935cfd Undid commit 12527, which contained much too much.
- Legacy-Id: 12528
2016-12-15 10:38:54 +00:00
Henrik Levkowetz e3c6e0ac6b Changed the state shown in all_id.txt for drafts which have entered IESG processing, but then been replaced, to show as 'Replaced' instead of 'In IESG Processing'. This is consistent with how they are shown in all_id2.txt.
- Legacy-Id: 12527
2016-12-15 10:36:15 +00:00
Henrik Levkowetz 6304bfda69 Fixed template_coverage_collection initialisation. Tweaked a message. Updated coverage numbers.
- Legacy-Id: 12471
2016-12-07 11:33:33 +00:00
Henrik Levkowetz 8f6e51839f Fixed some additional places to use the new settings.TEMPLATES structure.
- Legacy-Id: 12459
2016-12-05 19:04:27 +00:00
Henrik Levkowetz 0bb7854591 Merged django18 work forward to 6.39
- Legacy-Id: 12449
2016-12-05 14:01:25 +00:00
Henrik Levkowetz b897519fff Changed the test runner to use the verbosity set on the command line when loading fixtures.
- Legacy-Id: 12446
2016-12-05 12:56:53 +00:00
Henrik Levkowetz 554ec2d78c Removed an unused import
- Legacy-Id: 12406
2016-11-28 21:04:15 +00:00
Henrik Levkowetz 623ce0e1bd Merged in [12378] from rjsparks@nostrum.com:
Change the lines saying that a test has failed to make it easier to cut-paste to run the failed test again.
 - Legacy-Id: 12386
Note: SVN reference [12378] has been migrated to Git commit be51bc2e78
2016-11-18 10:45:40 +00:00
Robert Sparks be51bc2e78 Change the lines saying that a test has failed to make it easier to cut-paste to run the failed test again. Commit ready for merge.
- Legacy-Id: 12378
2016-11-17 02:52:45 +00:00
Henrik Levkowetz 964d34282f Added common patterns for template file names to ignore when testing template parsing and template test coverage.
- Legacy-Id: 12354
2016-11-16 02:14:32 +00:00
Henrik Levkowetz 888bd44a10 Stash the test results summary in ./.testresults instead of ./testresults, to avoid visual littering.
- Legacy-Id: 12272
2016-11-07 17:11:48 +00:00
Henrik Levkowetz 8d1aca19cc Rewrote the template coverage loader function to a proper template loader class.
- Legacy-Id: 12261
2016-11-03 20:51:06 +00:00
Henrik Levkowetz 7b6407dfed Rewrote the test runner command-line switch declarations to use parser.add_argument() instead of the now unsupported option_list class attribute.
- Legacy-Id: 12251
2016-11-03 20:07:22 +00:00
Henrik Levkowetz 3854c832a0 Change things so that the reorder_by setting has an effect on the test ordering. It didn't before, as CoverageTest was a subclass of the earlier entries in the reorder_by setting.
- Legacy-Id: 12039
2016-09-26 17:48:26 +00:00
Henrik Levkowetz e3020686a8 Added a global declaration
- Legacy-Id: 11647
2016-07-13 16:00:41 +00:00
Henrik Levkowetz a405449150 Cached the list of template paths in test_runner.py so we can call it multiple times cheaply.
- Legacy-Id: 11482
2016-06-28 04:44:25 +00:00
Henrik Levkowetz a36cf95572 Refactored the code to skip coverage testing a bit, and added skipping of template and url coverage.
- Legacy-Id: 11472
2016-06-24 15:39:59 +00:00
Henrik Levkowetz 6fa181763b Changed the code test coverage checking to never register coverage counts for tests that are sometimes skipped. Removed now unwanted skip settings from the releasetest settings.
- Legacy-Id: 11453
2016-06-21 20:39:28 +00:00
Henrik Levkowetz 2191ec3cbd Removed logging through ietf.utils.log.log when running tests -- should shave another 15% off the test suite run time.
- Legacy-Id: 10454
2015-11-08 14:26:41 +00:00
Henrik Levkowetz fdc7dea3df Merged in [10097] from olau@iola.dk, in order to speed up the test suite.
- Legacy-Id: 10453
Note: SVN reference [10097] has been migrated to Git commit 99a9cb5569
2015-11-08 14:24:19 +00:00
Henrik Levkowetz bfa222b782 Added a switch to the 'test' command, to write short test results to file, changing the default which used to be to always write these.
- Legacy-Id: 10270
2015-10-22 20:37:03 +00:00
Henrik Levkowetz c17ea94b08 Updated the code to use version 4.0.1 of coverage.py for code coverage measurements. Moved the code which starts coverage measurement to settings_sqlitetest.py to avoid coverage measurements running when not doing tests. Did some additional coveage measurement refactoring.
- Legacy-Id: 10238
2015-10-18 20:01:57 +00:00
Henrik Levkowetz 90b97468a9 Changed to use a gzipped release coverage JSON file, instead of a plain JSON file, if the name given in settings.py ends in .gz. Reduces the current release coverage file size from ~1.6MB to ~200kB. This is a preparation for saving more information in the release coverage file than we currently do.
- Legacy-Id: 10235
2015-10-18 14:32:36 +00:00
Henrik Levkowetz a23846c8be Changed the storage format for code coverage in *coverage.json, in order to be able to calculate code coverage percentages for a subset of tested files.
- Legacy-Id: 9953
2015-08-01 15:07:21 +00:00
Henrik Levkowetz 9cec8a0587 Added code to the test_runner to force SERVE_CDN_FILES_LOCALLY_IN_DEV_MODE to True during testing, to avoid triggering the system checks error which doesn't find the CDN symlink expected when serving static files via CDN.
- Legacy-Id: 9910
2015-07-28 11:02:00 +00:00
Henrik Levkowetz 0b971f635d Added test coverage data to the release pages if available for the release. Added saving of html pages for the code coverage to a directory in the static files area. If a code coverage report is available, a link to it will be shown on the release page of the current release. Renamed some setting variables related to test coverage to be more explicit and precise.
- Legacy-Id: 9201
2015-03-14 19:08:37 +00:00
Henrik Levkowetz d4f0ad4955 Fixed a pyflakes nit.
- Legacy-Id: 9189
2015-03-13 16:04:40 +00:00
Henrik Levkowetz f499ba8096 Started the code coverage measurements earlier, in order to make the apparent code coverage of model files less confusing.
- Legacy-Id: 9188
2015-03-13 16:02:31 +00:00
Henrik Levkowetz f15e515baf Added a fudge factor to the coverage test, in order to make it easier to do minor code changes.
- Legacy-Id: 9187
2015-03-13 15:56:13 +00:00
Henrik Levkowetz 1d28ec8f5b Made the test runner try multiple port numbers for the SMTP server, in order to handle the case where multiple test suites are in progress on the same host (which can happen when multiple buildbot slaves are running tests at the same time).
- Legacy-Id: 9186
2015-03-13 15:47:12 +00:00
Henrik Levkowetz 5ee64000c3 Changed the test runner to read json files as utf-8.
- Legacy-Id: 9163
2015-03-07 22:28:21 +00:00
Henrik Levkowetz 0be1ad9a2d Fixed a bug in the template coverage expression. Tweaked the informative text prefacing app coverage figures.
- Legacy-Id: 9157
2015-03-06 23:22:54 +00:00
Henrik Levkowetz e94ac990fc Added per-app coverage measurements, to make the numbers shown when not running the full tests suite a bit more meaningful.
- Legacy-Id: 9156
2015-03-06 20:42:20 +00:00
Henrik Levkowetz dba3db444c Added test code coverage measurements using coverage.py, integrated as a test in the test suite. This test compares the current code coverage of tests with that saved for the latest release. Also converted the URL and template coverage measurements into tests, comparing current with the latest release. The result of this is that the coverage tests will fail if new code is added without sufficient test coverage to at least match that of the latest release. Over time, this should encourage gradually improved test coverage as seen for both code, templates, and urls. Coverage data is also saved to file, and can be read by the 'coverage' shell command to produce html or text reports.
- Legacy-Id: 9103
2015-02-19 23:42:34 +00:00
Henrik Levkowetz fe5d53fc40 Merged in [7591] from rjsparks@nostrum.com:
Adds a real (if simple) SMTP server to the test framework and tests handling of exceptions and rejected addresses. Fixes ticket #1314.
 - Legacy-Id: 7613
Note: SVN reference [7591] has been migrated to Git commit 54919f01343995ab154d27dcfaf7a60b15dd5eee
2014-04-16 19:40:57 +00:00
Henrik Levkowetz 5d1bdde730 Added control by the --verbosity switch of the not loaded template test and not tested urls test, so they only will be run for verbosity greater than 1.
- Legacy-Id: 7244
2014-02-16 16:49:34 +00:00
Henrik Levkowetz 35cadc1763 Don't show deprecation warning during tests for verbosity < 2
- Legacy-Id: 7205
2014-02-04 21:35:19 +00:00
Ole Laursen e2554a6a0c It turns out that Django resetting the user if REMOTE_USER is not passed in is a problem on live to, so switch the whole code base to using the middleware to set REMOTE_USER from the logged in user if not passed in from the outside
- Legacy-Id: 7167
2014-01-24 14:30:00 +00:00
Ole Laursen 86f2baea0a Move group feed from wgcharter (where it historically ended up) to wginfo, add test
- Legacy-Id: 7086
2014-01-09 16:24:54 +00:00
Ole Laursen 954c8fcedb Fix spelling mistake in patterns that are ignored in coverage check
- Legacy-Id: 7080
2014-01-08 17:41:40 +00:00
Ole Laursen 8dc19fd17e Improve the coverage checker, skip some trivial views (redirects and
flat templates)
 - Legacy-Id: 7078
2014-01-08 17:00:37 +00:00
Ole Laursen 72e36bde55 Don't output coverage data if there are test failures
- Legacy-Id: 6959
2013-12-17 10:08:12 +00:00
Ole Laursen beda4bafcd Fix bug with coverage testing
- Legacy-Id: 6937
2013-12-16 13:06:41 +00:00
Ole Laursen 7aa3737c3b Reenable RemoteUserMiddleware, it turns out the Secretariat tests are
using REMOTE_USER to auth instead of logging in - instead include a
little middleware class that adds the REMOTE_USER header during
testing.

Also fix problem with the empty test_label hack not working with
double-dotted Secretariat apps.
 - Legacy-Id: 6935
2013-12-16 12:59:27 +00:00
Ole Laursen b4706af925 Fix problem with tests and RemoteUserMiddleware - it interferes with
the tests, also fix bug in previous test runner refactor
 - Legacy-Id: 6914
2013-12-13 15:37:04 +00:00
Ole Laursen dec6862787 Make GLOBAL_TEST_FIXTURES support Python functions as fixtures
- Legacy-Id: 6906
2013-12-13 13:13:03 +00:00
Ole Laursen c470e57dae Port test runner to new Django interface
- Legacy-Id: 6903
2013-12-13 11:22:40 +00:00
Ole Laursen 3053bef4cc Resurrect URL coverage making it work with all tests, and move it to the test runner together with the template coverage report
- Legacy-Id: 6844
2013-12-07 19:31:32 +00:00
Henrik Levkowetz d8e3e32ee7 Set TEMPLATE_STRING_TO_INVALID to '' during testing.
- Legacy-Id: 6493
2013-10-27 10:02:21 +00:00
Henrik Levkowetz a07f47a4a0 Added a new TestCase class, subclassing django.test.TestCase, in order to
be able to add fixtures once and for all for all tests, instead of loading
them again and again for each test, if running on a database that supports
transaction rollbacks.  In this case, fixtures specified in the perma_fixtures
class attribute will be loaded permanently, and not re-loaded.  Fixtures
specifice as before, in a fixtures class attribute, will be treated as
before.

The downside of this is that as fixtures are loaded and not unloaded, they
can conflict with each other.  The requirements on consistency becomes much
greater.  The effect of this has been to require quite a bit of changes to
the simplified creations of various objects in make_test_data() in cases
where identically named objects occur in fixtures.  Where completely
fictitious objects are created, no conflicts appear.

Also re-wrote parts of test_runner.py to permit global fixtures, loaded
before any tests are run and shared by all.
 - Legacy-Id: 6318
2013-09-30 20:22:24 +00:00
Henrik Levkowetz 6baea429aa Merged in the nomcom app from ejimenez@yaco.es and esanchez@yaco.es, and accompanying dbtemplate app and the (standard) docutils module. Added some tweaks to get all tests to pass and migrations to run.
- Legacy-Id: 5948
2013-08-06 10:09:29 +00:00
Henrik Levkowetz 3105101cc5 Changed test running and test data generation to work with database rollback
(for instance with InnoDB).

Added settings.DATABASE_TEST_OPTIONS which can be used to force for instance
InnoDB use during testing.

Using this has the potential of reducing the time it takes to run the test
suite substantially; a few test runs indicate a reduction in test run time by
50% on a run-of-the-mill linux server.
 - Legacy-Id: 5823
2013-07-15 07:21:34 +00:00
Henrik Levkowetz 9d9e2851e0 Test the argument list, not the tuple of argument tuple.
- Legacy-Id: 5134
2012-12-16 18:30:25 +00:00
Henrik Levkowetz 97a7ab30db Added simple logging of test runs, to make it easier to be sure that tests has been run successfully on the latest code.
- Legacy-Id: 5131
2012-12-15 22:47:11 +00:00
Henrik Levkowetz d0214d3b25 Merged [4806] from rjsparks@nostrum.com:
Better handling for BoFs, particularly those that won't create WGs
 - Legacy-Id: 4939
2012-10-21 14:40:02 +00:00
Henrik Levkowetz 1bc2f7daa2 Tweak test setup message for site_id change.
- Legacy-Id: 4567
2012-07-03 13:42:36 +00:00
Henrik Levkowetz 350914da15 Minor cleanup of test_runner.py. Added guards against settings which can make tests inexplicably fail. Updated check to avoid running tests on production server.
- Legacy-Id: 4564
2012-07-03 11:31:11 +00:00
Ole Laursen 9ae5f6a456 Make test runner multi-DB-aware
- Legacy-Id: 3786
2011-12-23 13:15:27 +00:00
Ole Laursen ce74be89ef Use the test mode in the mail code when running automated tests instead of
reinventing the wheel in test_runner
 - Legacy-Id: 3620
2011-11-15 11:24:33 +00:00
Ole Laursen f7eefe8ee2 Finally get the mail system during automated test to send the real
message (i.e. pretend to do) instead of sending a copy, should make it
a bit easier to write tests
 - Legacy-Id: 3595
2011-11-08 11:48:57 +00:00
Henrik Levkowetz 266b7820d0 Merged from log:branch/2.00@2363: Current release branch head to trunk.
- Legacy-Id: 2365
2010-07-21 12:48:05 +00:00