6 Commits

Author SHA1 Message Date
Jeremy Stanley
4570981c1b Don't test candidate files if they're removed
The routine to determine which files to check for candidacies, when
used to analyze files being changed with --HEAD, should only test
those files if they are being kept by the change. If they're being
deleted, then there is no reason to test them. Further, testing
files which are slated for removal makes it basically impossible to
revert a previously merged candidacy which has since been
invalidated (for example, by resigning OSF Individual Membership).

Mock os.path.exists in test_find_modified_candidate_files_all_good
to just return True, since we aren't actually creating the file in
that test.

Change-Id: I4d5d9b1d55379adfd1c7d7765324306abf40cdb7
2020-09-28 13:21:06 +00:00
Hervé Beraud
c08aed239d Use unittest.mock instead of mock
The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Change-Id: I0b5e9e60b00204f938d23fc4ff8e020ebb4afa43
2020-09-15 17:44:21 +00:00
Hervé Beraud
d113fc7087 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: I2f9d4c9a760bd9a9dbb9cde5bcb8af24fd4b34b9
2020-07-24 13:44:46 +02:00
Tony Breeds
488c68a80c Typo fix s/cadidate/candidate/
Sorry :(

Change-Id: I4605c860d60c735c14f5f53f67e4dc74eeb0104b
2019-02-19 15:21:08 +11:00
Tony Breeds
3bf36b7128 Don't validate .placeholder
When creating a new election we need to add a directory per project
(including the 'TC' as a pseudo project) we can't just create an empty
directory in git so we add a '.placeholder' file.

We have recently added a voting job that will run try to validate all
candidate files added in a review.  This includes the placeholder file.
CLearly this file will not pass validation and cause the job to fail.

Adding .placeholder to the zuul irrelevant-files variable wont work, so
instead filter .placeholder from the interesting files.

Change-Id: Ibd2224a5479d4ab9afbac227bac38080359a98bf
2019-01-10 15:50:24 +11:00
Tony Breeds
77c4fe302e Add some testing for ci_check_all_candidate_files
Change-Id: Id5a89a684e377532858ba2e3e78dff47b688d52b
2019-01-10 15:50:24 +11:00