def __init__(self, loader=None, config=None, client=None): self.loader = loader self.config = config or percy.Config() self.client = client or percy.Client(config=self.config) self._current_build = None self._is_enabled = os.getenv('PERCY_ENABLE', '1') == '1' # Sanity check environment and auth setup. If in CI and Percy is disabled, print an error. if self._is_enabled: try: self.client.config.access_token except errors.AuthError: if self.client.environment.current_ci: utils.print_error('[percy] Warning: Percy is disabled, no PERCY_TOKEN set.') self._is_enabled = False
def setUp(self): percy_config = percy.Config(access_token='abcd1234', default_widths=[1280, 375]) self.percy_client = percy.Client(config=percy_config)