Skip to content

Instantly share code, notes, and snippets.

@nomoa
Created October 31, 2017 15:13
Show Gist options
  • Save nomoa/26855218eaabb0ddbf41429c19c973e2 to your computer and use it in GitHub Desktop.
Save nomoa/26855218eaabb0ddbf41429c19c973e2 to your computer and use it in GitHub Desktop.
mjolnir/test/utilities/test_spark.py ..........F........
========================================= FAILURES ==========================================
test_load_config[/vagrant/mjolnir/test/fixtures/load_config/example_train.test-/vagrant/mjolnir/test/fixtures/load_config/example_train.expect]
monkeypatch = <_pytest.monkeypatch.MonkeyPatch instance at 0x7fc4cb4d2bd8>
test_file = '/vagrant/mjolnir/test/fixtures/load_config/example_train.test'
expect_file = '/vagrant/mjolnir/test/fixtures/load_config/example_train.expect'
@pytest.mark.parametrize(*generate_fixtures('load_config'))
def test_load_config(monkeypatch, test_file, expect_file):
monkeypatch.setenv('HOME', '/home/pytest')
monkeypatch.setenv('USER', 'pytest')
with open(test_file, 'r') as f:
global_config, profiles = mjolnir.utilities.spark.load_config(f, 'marker', {})
compare_fixture(expect_file, {
'global_config': global_config,
> 'profiles': profiles
mjolnir/test/utilities/test_spark.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
expect_file = '/vagrant/mjolnir/test/fixtures/load_config/example_train.expect'
generated = {'global_config': {'commands': {'data_pipeline': {'cmd_args': {'input': 'hdfs://analytics-hadoop/wmf/data/discovery/qu...nt/venv/bin/mjolnir-utilities.py', ...}}, 'wikis': ['svwiki', 'fawiki', 'idwiki', 'viwiki', 'nowiki', 'hewiki', ...]}}}
def compare_fixture(expect_file, generated):
as_json = json.dumps(generated, indent=4, sort_keys=True,
separators=(',', ': '), cls=SetEncoder)
if os.path.isfile(expect_file):
with open(expect_file, 'r') as f:
> assert json.loads(as_json) == json.loads(f.read())
E AssertionError: assert {'global_conf...wiki', ...]}}} == {'global_confi...wiki', ...]}}}
E Differing items:
E {'global_config': {'commands': {'data_pipeline': {'cmd_args': {'input': 'hdfs://analytics-hadoop/wmf/data/discovery/qu...r_utility': 'training_pipeline', 'mjolnir_utility_path': '/vagrant/venv/bin/mjolnir-utilities.py', ...}}, 'wikis': []}} != {'global_config': {'commands': {'data_pipeline': {'cmd_args': {'input': 'hdfs://analytics-hadoop/wmf/data/discovery/qu...r_utility': 'training_pipeline', 'mjolnir_utility_path': '/vagrant/venv/bin/mjolnir-utilities.py', ...}}, 'wikis': []}}
E {'profiles': {'large': {'commands': {'data_pipeline': {'cmd_args': {'input'...
E
E ...Full output truncated (2 lines hidden), use '-vv' to show
mjolnir/test/utilities/test_spark.py:62: AssertionError
=========================== 1 failed, 43 passed in 59.01 seconds ============================
ERROR: InvocationError: '/vagrant/.tox/pytest/bin/pytest --pyargs mjolnir'
__________________________________________ summary __________________________________________
flake8: commands succeeded
ERROR: pytest: commands failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment