From 54c4398cfd437b930be832e2faeed1a69cb62ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Sun, 30 Apr 2023 18:04:13 +0200 Subject: [PATCH] Create the maildir in the start_tests function --- tests/start_test.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/start_test.py b/tests/start_test.py index 379c6df..f5ec692 100755 --- a/tests/start_test.py +++ b/tests/start_test.py @@ -136,8 +136,26 @@ def fix_perms(path): subprocess.Popen([shutil.which("sudo"), shutil.which("chmod"), "-R", "777", path]) -def start_tests(test_dir, maildir, smtp_port): +def get_maildir(): + maildir = tempfile.TemporaryDirectory(prefix="Maildir_") + flags = ( + stat.S_IRUSR + | stat.S_IWUSR + | stat.S_IXUSR + | stat.S_IRGRP + | stat.S_IWGRP + | stat.S_IXGRP + | stat.S_IROTH + | stat.S_IWOTH + | stat.S_IXOTH + ) + os.chmod(maildir.name, flags) + return maildir + + +def start_tests(test_dir, smtp_port): # Sending emails to OpenSMTPD + maildir = get_maildir() f, d, filter_cmd = get_cmd_filter_dkimout( test_dir, "ed25519-sha256", "relaxed/relaxed", "debug" ) @@ -186,28 +204,10 @@ def start_tests(test_dir, maildir, smtp_port): print(f"{nb_failed} {msg} failed the DKIM signature test") -def get_maildir(): - maildir = tempfile.TemporaryDirectory(prefix="Maildir_") - flags = ( - stat.S_IRUSR - | stat.S_IWUSR - | stat.S_IXUSR - | stat.S_IRGRP - | stat.S_IWGRP - | stat.S_IXGRP - | stat.S_IROTH - | stat.S_IWOTH - | stat.S_IXOTH - ) - os.chmod(maildir.name, flags) - return maildir - - def main(): test_dir = pathlib.Path(__file__).parent.resolve() os.chdir(test_dir.parent) - maildir = get_maildir() - start_tests(test_dir, maildir, DEFAULT_PORT) + start_tests(test_dir, DEFAULT_PORT) if __name__ == "__main__":