def test_running_on_macos_ci(): with mock.patch.dict(os.environ, { 'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI': 'url', 'AGENT_OS': 'Darwin' }): assert running_on_ci() is True assert running_on_macos_ci() is True
def __call__(self): if not ON_WINDOWS: user = getpass.getuser() chown_args = ['chown', user, self.token_file] if user != 'root' and running_on_ci(): chown_args.insert(0, 'sudo') run_command(chown_args, check=True)
def test_not_running_ci(): with EnvVars(ignore=['SYSTEM_TEAMFOUNDATIONCOLLECTIONURI']): with mock.patch.dict(os.environ, {'AGENT_OS': 'Linux'}): assert running_on_ci() is False assert running_on_linux_ci() is False
def test_running_on_travis(): with mock.patch.dict(os.environ, {'TRAVIS': 'true'}): assert running_on_travis() is True assert running_on_ci() is True
def test_running_on_appveyor(): with mock.patch.dict(os.environ, {'APPVEYOR': 'true'}): assert running_on_appveyor() is True assert running_on_ci() is True
def test_not_running_ci(): with mock.patch.dict(os.environ, {'AGENT_OS': 'Linux'}): assert running_on_ci() is False assert running_on_linux_ci() is False