import unittest
import teradata
import os
import sys
import logging
configFiles = [os.path.join(os.path.dirname(__file__), file)
for file in ('udaexec.ini')]
class UdaExecConfigTest (unittest.TestCase):
"""Test UdaExec DevOps features."""
def setUp(self):
self.udaExec = teradata.UdaExec(
configFiles=configFiles, configureLogging=False)
self.udaExec.checkpoint()
self.assertIsNotNone(self.udaExec)
def testGlobals(self):
self.assertEqual(teradata.apilevel, "2.0")
self.assertEqual(teradata.threadsafety, 1)
self.assertEqual(teradata.paramstyle, "qmark")
if __name__ == '__main__':
formatter = logging.Formatter(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s")
sh = logging.StreamHandler(sys.stdout)
sh.setFormatter(formatter)
root = logging.getLogger()
root.setLevel(logging.INFO)
root.addHandler(sh)
unittest.main()
```----------------------------------------------------------------
and I got this error below... I have already updated appName=test in my "udaexec.ini" file...
I am not sure what is the problem here.. please help..!!
E
======================================================================
ERROR: testGlobals (__main__.UdaExecConfigTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "c:\Users\samola\Desktop\PyTd\test\test_udaexec_config.py", line 39, in setUp
configFiles=configFiles, configureLogging=False)
File "C:\Anaconda3\lib\site-packages\teradata\udaexec.py", line 108, in __init__
appName, errorMsg="appName is a required field, it must be "
File "C:\Anaconda3\lib\site-packages\teradata\udaexec.py", line 577, in resolve
return self._resolve(value, sections, default, errorMsg)
File "C:\Anaconda3\lib\site-packages\teradata\udaexec.py", line 598, in _resolve
raise api.InterfaceError(api.CONFIG_ERROR, errorMsg)
teradata.api.InterfaceError: ('CONFIG_ERROR', 'appName is a required field, it must be passed in as a parameter or specified in a config file.')
----------------------------------------------------------------------
Ran 1 test in 0.003s
FAILED (errors=1)
After updating my udaexec.ini file:
Application Configuration
[CONFIG] appName=test version=1.0 logConsole=False dataSourceName=sim table=DBC.DBCInfo
Default Data Source Configuration
[DEFAULT] method=odbc charset=UTF8
Data Source Definition
[sim] system=*** username=** password=**
I ran "test_udaexec_config.py" ran few unittest: