add support for with statement
update test case in test_register_modules(self) for with statement