summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-12-03 22:38:49 +0100
committerGitHub <noreply@github.com>2020-12-03 22:38:49 +0100
commita237979853a97945103291202d851de1e7bcd3f2 (patch)
treef4e54ec15563ae127f202bb19e9994341a7887bd /smoketest/scripts/cli
parenta0f115fb4304e29c38cb74d3be4969aa8136ae9d (diff)
parentcaedff0f1e5398590a65417f38694c7f847dcbc3 (diff)
downloadvyos-1x-a237979853a97945103291202d851de1e7bcd3f2.tar.gz
vyos-1x-a237979853a97945103291202d851de1e7bcd3f2.zip
Merge pull request #632 from sever-sever/T3108
smoketest: T3108: Fix regex for count pattern Config
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_configd_inspect.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/smoketest/scripts/cli/test_configd_inspect.py b/smoketest/scripts/cli/test_configd_inspect.py
index 5181187e9..4ebee8cc5 100755
--- a/smoketest/scripts/cli/test_configd_inspect.py
+++ b/smoketest/scripts/cli/test_configd_inspect.py
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
+import re
import json
import unittest
import warnings
@@ -78,7 +79,8 @@ class TestConfigdInclude(unittest.TestCase):
if not f:
continue
str_f = getsource(f)
- n = str_f.count('Config()')
+ # Regex not XXXConfig() T3108
+ n = len(re.findall(r'[^a-zA-Z]Config\(\)', str_f))
if i == 'get_config':
self.assertEqual(n, 1,
f"'{s}': '{i}' no instance of Config")
@@ -91,7 +93,8 @@ class TestConfigdInclude(unittest.TestCase):
for s in self.inc_list:
m = import_script(s)
str_m = getsource(m)
- n = str_m.count('Config()')
+ # Regex not XXXConfig T3108
+ n = len(re.findall(r'[^a-zA-Z]Config\(\)', str_m))
self.assertEqual(n, 1,
f"'{s}' more than one instance of Config")