summaryrefslogtreecommitdiff
path: root/smoketest/scripts
diff options
context:
space:
mode:
authorsever-sever <v.gletenko@vyos.io>2020-12-03 19:03:42 +0000
committersever-sever <v.gletenko@vyos.io>2020-12-03 19:03:42 +0000
commitcaedff0f1e5398590a65417f38694c7f847dcbc3 (patch)
treef4e54ec15563ae127f202bb19e9994341a7887bd /smoketest/scripts
parenta0f115fb4304e29c38cb74d3be4969aa8136ae9d (diff)
downloadvyos-1x-caedff0f1e5398590a65417f38694c7f847dcbc3.tar.gz
vyos-1x-caedff0f1e5398590a65417f38694c7f847dcbc3.zip
smoketest: T3108: Fix regex for count pattern Config
Diffstat (limited to 'smoketest/scripts')
-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")