1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
From 1d82b7eaf98e695689a7dc10bd308030e3c13eea Mon Sep 17 00:00:00 2001
From: Ondrej Nosek <onosek@redhat.com>
Date: Sat, 1 Apr 2023 01:34:34 +0200
Subject: [PATCH] Fix unittests for `clone` and pre-push hook script
Signed-off-by: Ondrej Nosek <onosek@redhat.com>
---
tests/commands/test_clone.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/commands/test_clone.py b/tests/commands/test_clone.py
index 6ef1300..85fdfd1 100644
--- a/tests/commands/test_clone.py
+++ b/tests/commands/test_clone.py
@@ -1,5 +1,6 @@
import os
import shutil
+import sys
import tempfile
import git
@@ -110,9 +111,10 @@ class CommandCloneTestCase(CommandTestCase):
moduledir = os.path.join(self.path, self.module)
self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
+ clonned_by = os.path.basename(sys.argv[0])
with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
content = git_hook_script.read()
- pattern = '__main__.py pre-push-check "$local_sha"'
+ pattern = '{0} pre-push-check "$local_sha"'.format(clonned_by)
self.assertIn(pattern, content)
shutil.rmtree(altpath)
@@ -132,9 +134,11 @@ class CommandCloneTestCase(CommandTestCase):
moduledir = os.path.join(self.path, self.module)
self.assertTrue(os.path.isfile(os.path.join(moduledir, '.git/hooks/pre-push')))
+ clonned_by = os.path.basename(sys.argv[0])
with open(os.path.join(moduledir, '.git/hooks/pre-push')) as git_hook_script:
content = git_hook_script.read()
- pattern = '__main__.py -C "/home/conf/rhpkg.conf" pre-push-check "$local_sha"'
+ pattern = '{0} -C "/home/conf/rhpkg.conf" pre-push-check ' \
+ '"$local_sha"'.format(clonned_by)
self.assertIn(pattern, content)
shutil.rmtree(altpath)
--
2.39.2
|