Reversing by Python paths has been deprecated in Django 1.8, causes
warnings in Django 1.9 and will be removed in Django 2.0. Resolve the
warnings and prevent issues in the future by importing by module
instead.
Reversing by Python paths has been deprecated in Django 1.8, causes
warnings in Django 1.9 and will be removed in Django 2.0. Resolve the
warnings and prevent issues in the future by referring to URLs by name,
rather than by Python path.
Reverse by name is an alternative to reverse by Python path. The names
must be added as a prerequisite for removing reverse by Python path,
per Django documentation.
This is a collection of unrelated functions, many of which belong in
their own file. Do this, taking the opportunity to rename some of these
functions to better indicate their purpose in the process.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
When a patch is delegated, it can be important to report it via
pwclient, as handing delegated patches may be different. So, add
an optional field at the email's body if this is happening.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com> Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
When things are broken at parsemail, we need to be able to
debug it. So, add some messages to it, in order to allow
checking what it actually did, and to let it return 1 if
an email got skipped by parsemail.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Laurent Pinchart [Sat, 28 Nov 2015 12:14:40 +0000 (10:14 -0200)]
forms: Allow the delegate field to keep its current value
When a patch is delegated at parse time (either through the
X-Patchwork-Hint mail header or through delegation rules), the delegate
might not be in the list of project maintainers.
Add the current delegate to the list of acceptable values for the
delegate field to allow the current value to be kept when editing the
patch.
Stephen Finucane [Thu, 17 Dec 2015 17:29:32 +0000 (17:29 +0000)]
parsearchive: Handle duplicates
The parsearchive tool can be used to load missing messages sourced
from mailman or another source. In this use case, there's a good
possibility that at least some of the messages found in the archive
are already stored in patchwork. Handle this case by ignoring these
duplicates.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Sun, 29 Nov 2015 18:58:41 +0000 (18:58 +0000)]
tox: Remove ignored PEP8 errors and directories
Remove the following 'ignore' errors:
E121-128,131 various visual indentation errors
E251 spaces around keyword / parameter equals
H405 multi-line docstring must have summary line
The only error remaining is E129, which is technically not part of the
PEP8 standard and contributes in practice besides lots of manual line
wrapping.
In addition, there's no good reason why the tests directory shouldn't
be assessed like everything else - tests are still code and, as such,
should be held to the same standards..
Finally, include the 'pwclient' script which should not be ignored.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Sun, 29 Nov 2015 06:53:05 +0000 (06:53 +0000)]
py3: Resolve unicode issues
Python 3 is unicode only. While many of the issues with unicode, such
as the now invalid 'u' prefix, have already been resolved, there are a
few more issues.
Many of these issues are related to HTTPResponse.content, which returns
bytes and needs to be "decoded" in order to perform actions like
concatenation with str objects (unicode). Where possible, make use of
assertContains, per the Django documentation (http://bit.ly/1lRDYie),
else fall back to including a 'decode' statement.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Sun, 29 Nov 2015 06:51:14 +0000 (06:51 +0000)]
py3: max does not accept 'None'
max(n, None), where n is a valid number, is valid in Python 2 but not
Python 3. Replace these calls with something that works in both
versions of Python.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Thu, 26 Nov 2015 19:43:37 +0000 (19:43 +0000)]
py3: "Modernize" code base
Run code through the 'modernize' application to fix Python 3
compatibility while also retaining Python 2 backwards compatibility.
There are some key changes made to the autogenerated code:
* Don't wrap 'items()' in 'list' for for loops - it's not necessary
* Don't wrap 'keys()' in 'list' - just drop 'keys()'
* Use Django's version of six rather than the upstream one
Many of the issues found are based upon the changed definitions of the
map, keys and items functions, along with the removal of the iteritems
function and reduce keyword.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Wed, 15 Apr 2015 15:44:23 +0000 (16:44 +0100)]
bin/parsearchive: Add rudimentary archive parsing
Add simple parsing of mbox archive files, as downloaded from a Mailman
instance. Currently this does not report errors or provide statistics
of any form.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Fri, 13 Nov 2015 03:32:51 +0000 (03:32 +0000)]
bin/parsemail: Support user-provided list ID
Sometimes mails won't contain the headers necessary to extract a
mailing list's ID (for example: mails downloaded from Mailman
archives). However, should the user already know the correct mailing
list ID then this extraction is not necessary.
Allow the user to provide a mailing list ID by the command line.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Fri, 13 Nov 2015 03:21:03 +0000 (03:21 +0000)]
trivial: Cleanup of 'bin/parsemail'
Do some cleanup of the script, removing excess whitespace and imports,
localising variables where possible etc. This file still isn't py3
compatible but it's getting there.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Tue, 24 Nov 2015 04:04:43 +0000 (04:04 +0000)]
management: Create 'rehash' command
The rehash script, though undocumented and possibly unused at the
moment, likely has some value to some users. Howver, it makes more
sense to provide this command as a management command like 'retag'.
Do this.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Sat, 21 Nov 2015 17:22:22 +0000 (17:22 +0000)]
settings: Add console email backend
Requiring configuration of an email server and email recipients for
debugging of email-based features is impractical. Use the console
backend provided by Django as the development default.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
aldot [Tue, 10 Nov 2015 20:53:09 +0000 (21:53 +0100)]
login: add link to password reset
Refurbished version from 2010
Doesn't mention the username in the mail but in the confirmation step.
Essentially the templates are all optional but they do look better (and
more integrated in patchwork) than the default django admin thing.
No testing beyond some bored clicking here and there.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Thu, 12 Nov 2015 06:01:29 +0000 (06:01 +0000)]
Cleanup requirements
* python-dateutil is only used in tests, so remove it from the
production requirements
* mysqlclient is prefered to MySQLdb, so use that [1]
* selenium does not have its version fixed, so resolve that
Stephen Finucane [Thu, 12 Nov 2015 05:17:45 +0000 (05:17 +0000)]
Rework configurable 'PW_TEST_DB_xxx' settings
There are a number of environment variables that users can set to
configure different aspects of their testing environment. Rework these
like so:
* People use PostgreSQL, so make it as easy as possible for them to
develop and test against it. Add a 'PW_TEST_DB_TYPE' setting
* Attempt to use defaults for the username and password in settings
* Allow the user to configure the database name, if they so wish
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Thu, 12 Nov 2015 04:54:31 +0000 (04:54 +0000)]
Add requirements-test.txt
It's annoying that Django is not installed by default when setting up
a development environment. This is currently necessary because tox
uses these requirements files and it needs to test against multiple
versions of Django. Resolve this issue by adding a 'requirements-test'
file, thus allowing for Django-ful and Django-less scenarios.
This also allows us to delete 'requirements-base', which was a good
idea but alas contained too few options to really be viable. A little
duplication is better here.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Thu, 12 Nov 2015 04:48:29 +0000 (04:48 +0000)]
Move requirements into base directory
These are documentation and therefore don't belong in the documentation
directory. The base directory is the usual location for these files, so
move them there.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
create_email() can use the default project for its mail. If that is the
case, chances are we are going to use that email later in a test where
we'll want that project to exist.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Damien Lespiau [Thu, 5 Jun 2014 00:27:08 +0000 (01:27 +0100)]
tests: Make sure all emails have a valid msgid
Messages ids will be used by the Series code as the way to uniquely
identify series. We must ensure every single email that goes through the
parser has a valid msgid to not fail once we parse series.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Using exceptions for flow control is bad. Be consistent and instead
use proper functions to check for version support. This also allows
the use of tools to automatically identify feature flags when
removing support for Django versions in the future.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Thu, 23 Jul 2015 10:54:04 +0000 (11:54 +0100)]
templates/patch-list: Add patch "checks" column
Add a column to display the important "checks" fields for each patch.
Note that only the "completed" checks are shown (i.e. "in progress" and
"not started" checks are ignored).
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Stephen Finucane [Thu, 23 Jul 2015 10:53:13 +0000 (11:53 +0100)]
models: Add properties related to checks
Add properties for 'Patch' to get the unique checks associated with
a patch, the total number of each type of check and the combined state
of the check. These will be necessary to display this information to
the user.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
Though already mentioned in the CHANGELOG, the UPGRADING document
should describe plans to deprecate support for Django 1.6. This will
ensure sysadmins are not suprised when they attempt to upgrade.
Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
tests: Add a way for the user to skip selenium tests
It's a bit more convoluted to setup the test environment to work with
selenium (eg. needs a browser installed and Xorg running, ...). It's
possible someone would want to skip those.
v2: Use 'PW' prefix rather than 'PATCHWORK', per existing test
parameters, and pass said variable through tox
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
While developing the new series UI, several bug crept in but weren't
discovered until later. All because we don't have in-browser tests to go
along the lower level tests we already have.
In particular, behaviours that need javascript to run cannot be tested
outside of a full environment with the pages being served to an actual
browser.
This commit introduces selenium to the test suite and starts with 2
simple tests to give a taste of what it looks like.
test_default_focus: make sure we do focus the username field on the
login page
test_login: shows how to chain actions to test the full login phase.
This is quite similar the lower level test, except it also
checks we display the username once logged in.
v2: Use LiveServerTestCase for django pre-1.7
v3: Propagate the DISPLAY environment variable to have an X display
specified for the browser
v4: Log execution of the chrome driver, useful for debugging
v5: Rebase on top of upstream
v6: Pass environmental variables to tox and ensure PEP8 compliance
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>
In the case where the tests are run by multiple processes in parallel
(for example, in the context of several simultaneous continuous
integration builds), the processes will compete for the same address, and
therefore your tests might randomly fail with an "Address already in use"
error. For example:
Traceback (most recent call last):
File
".../python2.7/site-packages/django/test/testcases.py",
line 1193, in setUpClass
raise cls.server_thread.error
error: [Errno 98] Address already in use
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
tests: Don't change settings.STATIC_URL in the XML-RPC tests
I tracked down a weird bug where the Selenium tests supposed to serve
all static files (.css, .js. ...) weren't doing so when running the
full test suite, but everything was working when running the tests in
isolation.
Turns out one of the other tests was changing settings.STATIC_URL
mid-way without restoring the original value in tearDown() and thus
impacting other tests.
It seems that this change wasn't necessary, the XML-RPC server doesn't
server any static file anyway.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
We don't want prompts when running tests, especially when they are run
through tox and most likely on a CI server.
When cancelling a test mid-way, the test db is not destroyed ans
subsequent runs will fail trying to create it and asking the user what
to do. --noinput will use the default answer, that is to destroy the
test db and start anew.
v2: Rebase on top of upstream
v3: Rebase, yet again.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com> (v2)
Damien Lespiau [Mon, 24 Aug 2015 16:54:08 +0000 (17:54 +0100)]
filters: Fix submitter display when we only have an email address
I'm fairly sure I fixed that already, but here we go again. It's totally
valid to only have an email address for the submitter, so handle that
case properly.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Damien Lespiau [Mon, 24 Aug 2015 16:49:52 +0000 (17:49 +0100)]
filters: Submit the form when <Enter> is pressed on a closed submitter field
<Enter> when an element of the form is focused should submit the form.
Before this patch, when <Enter> was pressed on the submitter button,
nothing would happen.
So, we tweak our <Enter> handling on the submitter input a bit more:
<Enter> can be used to select the submitter from the autocompletion
list, but, when pressed a second time (ie. when the autocompletion
option has be selected and the dropdown isn't shown), we submit the
form.
Damien Lespiau [Mon, 24 Aug 2015 16:27:49 +0000 (17:27 +0100)]
filter: Tweak the autocompletion behaviour on <Enter>
No patch has landed yet and we've already had feedback from users (which
is a good thing!) that didn't want to lose the "quick" submitter search
by just typing a string and pressing <Enter> without having to wait for
the autocompletion to finish.
This will also make <Enter> do something useful for input strings that
have fewer than 4 characters, the autocompletion query only triggers
after that.
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Damien Lespiau [Fri, 21 Aug 2015 15:04:03 +0000 (16:04 +0100)]
patch-list: Use table-condensed to display the patch list
Wolfram didn't like the fact we're now seeing far fewer patches on a
single page. That sounds fair enough and the table-condensed bootstrap
class removes some padding, hopefully making it better.
Suggested-by: Wolfram Sang <wsa@the-dreams.de> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Acked-by: Stephen Finucane <stephen.finucane@intel.com>
Damien Lespiau [Sat, 1 Nov 2014 19:01:50 +0000 (19:01 +0000)]
patch: Single out the commit message
All 'Comments' are stored the same way in the db, but I believe it's
worth making the distinction between introducing what the patch does and
eventual review comments.
v3: Fix docstrings
v2: Use two new Patch methods to retrieve the commit message and the
other comments (called answers here) (Jeremy Kerr)
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com>