| 219 | return self._context.get(key) |
| 220 | |
| 221 | def _detect_source_root(self): |
| 222 | root = None |
| 223 | try: |
| 224 | import library.python.find_root |
| 225 | # try to determine source root from cwd |
| 226 | cwd = os.getcwd() |
| 227 | root = library.python.find_root.detect_root(cwd) |
| 228 | |
| 229 | if not root: |
| 230 | # try to determine root pretending we are in the test work dir made from --keep-temps run |
| 231 | env_subdir = os.path.join("environment", "arcadia") |
| 232 | root = library.python.find_root.detect_root(cwd, detector=lambda p: os.path.exists(os.path.join(p, env_subdir))) |
| 233 | except ImportError: |
| 234 | logging.warning("Unable to import library.python.find_root") |
| 235 | |
| 236 | return root |
| 237 | |
| 238 | def _detect_output_root(self): |
| 239 | |