In preparation for the transition to Python 3, convert to using the
print function. The special import
from __future__ import print_function
in Python 2.7 makes "print" become the function and not the statement.
In Python 3, it has no effect. Once the transition is done and we
exclusively use Python 3, we can simply remove the imports.
The testsuite shows no regressions.
This option allows projects to ask the git-hooks to perform custom
checks of any kind to validate every new commit being pushed.
This commit also contains a change in hooks/updates/emails.py which
enhances the email-sending debug tracing mechanism used by the testsuite,
adding support for a tracing mode where the traces are just one line
per email. Technically, this change is independent from the rest,
but it is merged with this commit nonetheless because these changes
would show up as uncovered by the testsuite without the testcases
we're adding here. That way, we maintain the principle that we always
have 100% testing coverage for any commit.
Change-Id: I0e446a95d05f5578f977af3eaa547144187eb86b
TN: T209-005
Just import the one symbol that's actually used by the various
testcases in its place. This allows us to pass all current
style checks at AdaCore for Python files.
Change-Id: I458060771e18684e097e98131f292e09690a2e6d
When a test wants to verify the output of a given command, it normally
does this as follow:
self.assertRunOutputEqual(p, expected_out)
What this does is verify that the command's output matches, and if it
does not, then it not only reports and error, but also provides a diff
at the end, so as to facilitate the analysis.
However, while writing a test where that was unexpected failing
an output comparison, the diff in the error message was empty.
After investigation, it turned out that the function used to compute
that diff has a parameter ignore_white_chars set to True, which is
not what we want, here, and explains the discrepancy.
This commit fixes that by explicitly setting that parameter to False.
In the situation described above, this allowed the difference to
be shown in the diff section.
Change-Id: Ie5df10bcd7990eab928fc6f7fed3f41eaaa5d469
Do not use os.getcwd to compute the testcase's directory, as one
testcase may have multiple tests, and each test might do a "cd",
thus modifying the current working directory and thus affecting
the next testcase. Luckily, we have TEST_DIR already, so we might
as well use that.
Since we're about to allow the use of an alternate style-checker,
and since the name "cvs_check" contains the name of an old technology
we abandonned many years ago, it seems like a good idea to introduce
a more neutral name for that tool.
There is one, non-upward-compatible user-visible change: The script
now uses the GIT_HOOKS_STYLE_CHECKER environment variable, instead
of the GIT_HOOKS_CVS_CHECK environement as a backdoor to specifying
an alternate style-checker. This should be OK, however, as this
feature was really only meant to be used during testing, and is,
in practice, only really usable in that context.
This is prep work before introducing a new config option allowing
the repository to use an alternate style checker.
Part of MA09-043.
It turns out that making info/attributes group-writable is not
sufficient: A second user is allowed to overwrite the file, but
then the hooks fail when trying to change the file permissions
to make it group-writable.
We will use a different approach which should not need this anymore.
Part of M116-004.
A user needs to be able to overwrite this file, so we make it
group-writable.
Update the testsuite to verify this requirement for both
a repository's .gitattribute file, as well as the bare
repository's default_attribute file.
This method verifies that the output of a Run is equal to the given
expected output, and otherwise prints the command's image, actual
output, followed by a diff. The "diff" is the part that's new, and
allowed to quickly determine the difference, as the expected output
tends to be quite long in a typical test.
Update all testcases accordingly.
There is a trailing \033[K sequence (terminal control sequence
that tells the terminal to erase the end of the line) which seems
to be generated by git, and it makes matching the output a little
more difficult than necessary. So we create a subclass of
gnatpython.ex.Run which provides an additional property containing
the santized output.
While at it, we also added another property which replaces the
ex_run_image function.
Update all testcases throughout.
This patch forces the scripts to use a specific directory as the root
for their own temporary directories/files. We create it as an empty
directory at the start of the testcase, and then verify at the end
that it is still empty. If not, the testcase will report a failure.
This patch also makes sure that, even if the scripts do leak some
files/directories, the testsuite catches those and deletes them.
This finally merges the two parallel infrastructures defined in
post_receive.py and the update modules+sub-modules. This allows
us to treat each type of update within its own module, rather
than having a gigantic post_receive.py file. Also, every aspect
related to a given update is all handled within the same module.
There was a unit test for post_receive.py's AbstractRefChange,
which has now been replaced by the corresponding unit test for
class update.AbstractUpdate. This also required a minor upgrade
of the unit-test infrastructure.
The changes should all be internal. There should be no user-visible
changes.