I have a dictionary which looks like this and is needed needed by all methods in the test class, is there a way to @mock.patch.dict it at class level rather than doing it at top of each method. The dictionary is set some os.environ variables as shown here:
@mock.patch.dict('os.environ',
{'MSSQL_DB_NAME': 'tempdb',
'MSSQL_USERNAME': 'sa',
'MSSQL_PASSWORD': 'password',
'MSSQL_DSN': 'MYMSSQL'})
@mock.patch("commonutils.connectors.mssql.pyodbc")
def test_connectivity(self, my_pyodbc):
self.db = Database(os.environ['MSSQL_DB_NAME'],
os.environ['MSSQL_DSN'],
os.environ['MSSQL_USERNAME'],
os.environ['MSSQL_PASSWORD'])