diff --git a/src/nsidc/metgen/aws.py b/src/nsidc/metgen/aws.py index 20189b3..0955777 100644 --- a/src/nsidc/metgen/aws.py +++ b/src/nsidc/metgen/aws.py @@ -10,7 +10,7 @@ def kinesis_stream_exists(stream_name): """ client = boto3.client("kinesis") try: - summary = client.describe_stream_summary(StreamName=stream_name) + client.describe_stream_summary(StreamName=stream_name) return True except Exception: return False diff --git a/tests/test_aws.py b/tests/test_aws.py index eae8a3d..5f5dae6 100644 --- a/tests/test_aws.py +++ b/tests/test_aws.py @@ -57,7 +57,7 @@ def s3(aws_credentials): def s3_bucket(s3): """Create an S3 buket and return the bucket name.""" bucket_name = "duck-test-bucket" - response = s3.create_bucket( + s3.create_bucket( Bucket=bucket_name, CreateBucketConfiguration={ 'LocationConstraint': 'us-west-2' diff --git a/tests/test_cli.py b/tests/test_cli.py index 7540de3..84f36ec 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -53,7 +53,7 @@ def test_process_requires_config(mock, cli_runner): @patch('nsidc.metgen.config.validate') @patch('nsidc.metgen.metgen.process') def test_process_with_config_calls_process(mock_validate, mock_process, cli_runner): - result = cli_runner.invoke(cli, ['process', '--config', './example/modscg.ini']) + cli_runner.invoke(cli, ['process', '--config', './example/modscg.ini']) assert mock_process.called @patch('nsidc.metgen.config.validate') @@ -78,7 +78,7 @@ def test_process_with_no_write_cnm(mock_validate, process_mock, configuration_mo assert configuration_mock.called args = configuration_mock.call_args.args overrides = args[1] - assert overrides['write_cnm_file'] == None + assert overrides['write_cnm_file'] is None assert result.exit_code == 0 @patch('nsidc.metgen.config.configuration') @@ -90,7 +90,7 @@ def test_process_with_write_cnm(mock_validate, process_mock, configuration_mock, assert configuration_mock.called args = configuration_mock.call_args.args overrides = args[1] - assert overrides['write_cnm_file'] == True + assert overrides['write_cnm_file'] assert result.exit_code == 0 @patch('nsidc.metgen.config.configuration') @@ -102,7 +102,7 @@ def test_process_with_no_overwrite(mock_validate, process_mock, configuration_mo assert configuration_mock.called args = configuration_mock.call_args.args overrides = args[1] - assert overrides['overwrite_ummg'] == None + assert overrides['overwrite_ummg'] is None assert result.exit_code == 0 @patch('nsidc.metgen.config.configuration') @@ -114,7 +114,7 @@ def test_process_with_overwrite(mock_validate, process_mock, configuration_mock, assert configuration_mock.called args = configuration_mock.call_args.args overrides = args[1] - assert overrides['overwrite_ummg'] == True + assert overrides['overwrite_ummg'] assert result.exit_code == 0 # TODO: When process raises an exception, cli handles it and displays a message diff --git a/tests/test_config.py b/tests/test_config.py index c70e7c7..96f4916 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -72,7 +72,7 @@ def test_config_parser_handles_empty_strings_for_booleans(mock): cp['foo'] = { 'success': '' } - assert cp.getboolean('foo', 'success') == False + assert not cp.getboolean('foo', 'success') def test_config_from_config_parser(cfg_parser): cfg = config.configuration(cfg_parser, {}, constants.DEFAULT_CUMULUS_ENVIRONMENT) @@ -101,7 +101,7 @@ def test_config_with_write_cnm(cfg_parser, expected_keys): assert cfg.auth_id == 'DATA-0001' assert cfg.kinesis_stream_name == 'xyzzy-uat-stream' assert cfg.environment == 'uat' - assert cfg.write_cnm_file == True + assert cfg.write_cnm_file def test_config_with_no_overwrite_ummg(cfg_parser, expected_keys): cfg = config.configuration(cfg_parser, {}, constants.DEFAULT_CUMULUS_ENVIRONMENT) @@ -116,7 +116,7 @@ def test_config_with_overwrite_ummg(cfg_parser, expected_keys): config_keys = set(cfg.__dict__) assert len(config_keys - expected_keys) == 0 - assert cfg.overwrite_ummg == True + assert cfg.overwrite_ummg def test_get_configuration_value(cfg_parser): environment = constants.DEFAULT_CUMULUS_ENVIRONMENT @@ -154,7 +154,7 @@ def test_configuration_has_good_defaults(cfg_parser, section, option, expected): def test_validate_with_valid_checks(m1, m2, m3, cfg_parser): cfg = config.configuration(cfg_parser, {}) valid = config.validate(cfg) - assert valid == True + assert valid @patch('nsidc.metgen.metgen.os.path.exists', return_value = False) @patch('nsidc.metgen.metgen.aws.kinesis_stream_exists', return_value = False) diff --git a/tests/test_metgen.py b/tests/test_metgen.py index cec65c2..c73f045 100644 --- a/tests/test_metgen.py +++ b/tests/test_metgen.py @@ -120,7 +120,7 @@ def test_end_ledger(mock_datetime): actual = metgen.end_ledger(ledger) assert actual.granule == granule - assert actual.successful == True + assert actual.successful assert actual.startDatetime == now assert actual.endDatetime == now @@ -136,7 +136,7 @@ def test_end_ledger_with_unsuccessful_actions(mock_datetime): actual = metgen.end_ledger(ledger) assert actual.granule == granule - assert actual.successful == False + assert not actual.successful assert actual.startDatetime == now assert actual.endDatetime == now @@ -159,4 +159,4 @@ def failing_op(): assert new_ledger.granule == ledger.granule assert len(new_ledger.actions) == 1 - assert new_ledger.actions[0].successful == False + assert not new_ledger.actions[0].successful