def test_shard_default_local_explodes(self) -> None: with mock.patch.dict(os.environ): os.environ.pop('CI', None) os.environ.pop('BUILD_PART_ID', None) os.environ.pop('DATACENTER', None) os.environ.pop('USER', None) with self.assertRaisesRegex( AssertionError, 'Expected USER environment variable to be set'): _shard_default()
def test_shard_default_environment_ignoring_shard(self) -> None: with mock.patch.dict(os.environ): os.environ.pop('CI', None) os.environ.pop('BUILD_PART_ID', None) os.environ['IGNORE_NEPTUNE_SHARD'] = 'True' actual = _shard_default() self.assertIsNone(actual)
def test_shard_default_also_local(self) -> None: with mock.patch.dict(os.environ): os.environ.pop('CI', None) os.environ.pop('BUILD_PART_ID', None) os.environ.pop('DATACENTER', 'local') os.environ['USER'] = '******' actual = _shard_default() self.assertEqual('jack', actual)
def test_shard_default_ci(self) -> None: with mock.patch.dict(os.environ): os.environ['CI'] = 'x' os.environ['BUILD_PART_ID'] = '12345' os.environ.pop('DATACENTER', None) os.environ['USER'] = '******' actual = _shard_default() self.assertEqual('12345', actual)
def test_shard_default_environment_staging(self) -> None: with mock.patch.dict(os.environ): os.environ.pop('CI', None) os.environ.pop('BUILD_PART_ID', None) os.environ['DATACENTER'] = 'x' os.environ['USER'] = '******' os.environ['ENVIRONMENT'] = 'staging' actual = _shard_default() self.assertIsNone(actual)