ATest: Solve bug when someone outside ATest uses module-info.py.
AIDEGen hit import error due to module-info is dependent on test_finders.
Solution: Refactor is_robolectric_module from test_finder_util to
module-info.
Bug: 127425850
Test: m aidegen ; aidegen-dev --help
m atest ; atest-dev hello_world_test
Change-Id: I7f18dfd29e221a889b78a008c63e857615a2bd69
diff --git a/atest/module_info_unittest.py b/atest/module_info_unittest.py
index b6537c8..2570ab2 100755
--- a/atest/module_info_unittest.py
+++ b/atest/module_info_unittest.py
@@ -271,5 +271,17 @@
self.assertFalse(mod_info.is_auto_gen_test_config(MOD_NAME3))
self.assertFalse(mod_info.is_auto_gen_test_config(MOD_NAME4))
+ def test_is_robolectric_module(self):
+ """Test is_robolectric_module correctly detects the module."""
+ mod_info = module_info.ModuleInfo(module_file=JSON_FILE_PATH)
+ is_robolectric_module = {'class': ['ROBOLECTRIC']}
+ is_not_robolectric_module = {'class': ['OTHERS']}
+ MOD_INFO_DICT[MOD_NAME1] = is_robolectric_module
+ MOD_INFO_DICT[MOD_NAME2] = is_not_robolectric_module
+ mod_info.name_to_module_info = MOD_INFO_DICT
+ self.assertTrue(mod_info.is_robolectric_module(MOD_INFO_DICT[MOD_NAME1]))
+ self.assertFalse(mod_info.is_robolectric_module(MOD_INFO_DICT[MOD_NAME2]))
+
+
if __name__ == '__main__':
unittest.main()