Skip to content

Commit

Permalink
Resolve remainder of Ruff checks
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenbeam committed Nov 27, 2024
1 parent 4bf496b commit ab77741
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/nsidc/metgen/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
10 changes: 5 additions & 5 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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')
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_metgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

0 comments on commit ab77741

Please sign in to comment.