This commit is the result of running the following command in
the testsuite/ directory:
$ sed -i '/^from\s\+__future__\s\+import\s\+print_function\s*$/d' \
`git grep print_function | cut -d: -f1 | sort -u`
Change-Id: Idb18a24f5368434a505af42b347b8f2a1d0481b5
TN: U530-006
Now that the hooks are Python 3.x-only, and that we have a new framework
to run the testsuite with Python 3.x, delete the old Python-2.x-based
testsuite framework.
Change-Id: If8f72a3a8f747f768f673dcca42c63f592ee57f7
TN: U530-006
This script, which is used as a replacement for sendmail when
running the testsuite, has two modes. In the default mode,
it currently does nothing more than dumping to standard output
the email being asked to send.
This commit changes the script to parse the email instead, and
dump its contents once parsed, rather than dumping the email
as is. The dumping is written so to keep the output the same.
The goal is to help print the email body in a human-readable way
regardless of its content transfer encoding. This will become
particularly useful when we start using base64 content transfer
encodings.
This is tied to the transition to Python 3.x, where the email
support classes automatically chooses base64 transfer encoding
in some cases. More generally speaking, we have plans to use
base64 more often, as this format ensures that we do not exceed
some limitations in email transport (maximum line length, for
instance).
TN: U530-006
Change-Id: I645126470e8a3b944ff668aba6d30381d418c6b1
The goal of this commit is to include the updates.sendmail module
in our testing strategy, in order to make sure that the hooks are
passing email data down to the sendmail program without issues.
This will become particularly important when we switch over to
using Python 3.x, because of the strong distinction between bytes
and strings with newer versions of Python which can cause a lot
problems. Hence the need to use this code during our testing.
The main strategy introduced by this commit to achieve this is
fairly simple: The testsuite framework introduces a new minimal
script to be called in place of the standard sendmail. A new
environment variable called GIT_HOOKS_SENDMAIL is introduced
allowing the testsuite to tell the hooks to use its own (fake)
sendmail instead of the system one. With that in place,
the old code bypassing the use of updates.sendmail can be removed,
thus allowing the testsuite to include it as part of the testing.
The testsuite's (fake) sendmail script was written in a way to
mimick the old bypassing code, so there is no change in output.
Parallel to that, the hooks are enhanced to check that we can
indeed find sendmail, and otherwise return immediately with
an error if not. This way, we avoid emails silently being
dropped due to the missing sendmail.
A couple of testcases are also added to double-check some
specific error situations.
Note that I tried to think of ways to split this patch into
smaller individual parts, but couldn't really find a way to
do so in a meaningful way, while at the same time producing
a commit where the coverage report stays clean (0 lines missed).
TN: U530-006 (transition to Python 3.x)
TN: U924-032 (test for sendmail not found)
TN: U924-034 (test for sendmail override when in testsuite mode)
Change-Id: I74b993592ec6d701347bbca5283a42e037411f1c
This commit removes another use of gnatpython in the testsuite, this time
eliminating the use of gnatpython.ex.Run, using the equivalent Popen class
instead. With Python 3.x, we would be able to write this a bit more simply
thanks to the "subprocess.run" function, but we are are to ready to drop
support for Python 2 yet, so we implemented this in a way that works with
both Python 2 and Python 3.
Change-Id: I9a1e9c0ece11de4ce5001d052cffc20ac97bd566
TN: U530-006
This is another step towards moving away from gnatpython, which is
only available with Python 2.x. In this case, it was really
straightforward to use shutil.rmtree.
Change-Id: Idab48884e7e7072f8d0a7f64f196270424bc5ec6
TN: U530-006
This is a small step towards migrating this testsuite towards
a pytest-based framework: The filename currently used for testcases
is "test.py", and that filename does not match the nomenclature
that pytest expects for testcase files. So this commit renames
all our testcases to something that pytest can identify as a testcase
file to load and execute, and then adjusts the current testsuite
framework accordingly.
Change-Id: I77fba65e8ea20612259c6ad10459fe96ef77a2fc
... instead of the repository's config file. For compatibility,
a fallback mechanism that falls back on reading the $GIT_DIR/config
file is provided.
For MC20-031.
We are still preserving the hooks_config file within the test
directory in order to help grep-ability, but this is no longer
the master. The pack-test-repos script has been updated to grab
and update our convenience copy to match the latest master.
Similarly, the unpack-test-repos script has been updated to use
the project.config file (ie, use the master copy) to populate
the bare repository's config file. It is expected that this part
will become unnecessary at some point, when the hooks are enhanced
to get their config from this file, instead of the repository's
config file.
For MC20-031.
... not just the bare/repo.git directory. That way, we can have
multiple bare repositories. This can be useful in the context of
git submodules, where multiple git repositories are in use.
The current approach was not working, because it is hard to check in
a complete bare repository. Also, checking git repositories had the
disadvantage that the git repositories always contain a LOT of files,
flooding the other changes with those changes. It is easier in all
counts to just use an archive.
This does not fix the testcases themselves, but the checked in versions
do not work anyway, it doesn't make things worse in practice.