Module osbot_utils.testing.Temp_Sys_Path

Expand source code
import sys


class Temp_Sys_Path:
    def __init__(self, path):
        self.path = path

    def __enter__(self):
        sys.path.append(self.path)
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        sys.path.remove(self.path)

Classes

class Temp_Sys_Path (path)
Expand source code
class Temp_Sys_Path:
    def __init__(self, path):
        self.path = path

    def __enter__(self):
        sys.path.append(self.path)
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        sys.path.remove(self.path)