Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classify - Fix file loader tests #337

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests/unit/pypyr/loaders/file_test.py
@@ -1,13 +1,13 @@
"""fileloader.py unit tests."""
from pathlib import Path
from unittest.mock import call, mock_open, patch, PropertyMock
from unittest.mock import PropertyMock, call, mock_open, patch

import pytest

import pypyr.cache.admin
from pypyr.errors import PipelineNotFoundError
import pypyr.loaders.file as fileloader
from pypyr.pipedef import PipelineDefinition, PipelineFileInfo
from pypyr.errors import PipelineNotFoundError
from pypyr.pipedef import PipelineBody, PipelineDefinition, PipelineFileInfo

# region get_pipeline_path

Expand Down Expand Up @@ -161,7 +161,7 @@ def test_get_pipeline_path_raises_parent_is_cwd():


@patch('pypyr.loaders.file.add_sys_path')
@patch('ruamel.yaml.YAML.load', return_value='mocked pipeline def')
@patch('ruamel.yaml.YAML.load', return_value={})
@patch('pypyr.loaders.file.get_pipeline_path',
return_value=Path('arb/path/x.yaml'))
def test_get_pipeline_definition_pass(mocked_get_path,
Expand All @@ -176,7 +176,7 @@ def test_get_pipeline_definition_pass(mocked_get_path,
'pipename', '/parent/dir')

assert pipeline_def == PipelineDefinition(
'mocked pipeline def',
PipelineBody.from_mapping({}),
PipelineFileInfo(pipeline_name='x.yaml',
loader='pypyr.loaders.file',
parent=Path('arb/path'),
Expand All @@ -194,7 +194,7 @@ def test_get_pipeline_definition_pass(mocked_get_path,


@patch('pypyr.loaders.file.add_sys_path')
@patch('ruamel.yaml.YAML.load', return_value='mocked pipeline def')
@patch('ruamel.yaml.YAML.load', return_value={})
@patch('pypyr.loaders.file.get_pipeline_path',
return_value=Path('arb/path/x.yaml'))
def test_get_pipeline_definition_clear_all_cache(mocked_get_path,
Expand All @@ -209,7 +209,7 @@ def test_get_pipeline_definition_clear_all_cache(mocked_get_path,
'pipename', '/parent/dir')

assert pipeline_def == PipelineDefinition(
'mocked pipeline def',
PipelineBody.from_mapping({}),
PipelineFileInfo(pipeline_name='x.yaml',
loader='pypyr.loaders.file',
parent=Path('arb/path'),
Expand All @@ -228,7 +228,7 @@ def test_get_pipeline_definition_clear_all_cache(mocked_get_path,


@patch('pypyr.loaders.file.add_sys_path')
@patch('ruamel.yaml.YAML.load', return_value='mocked pipeline def')
@patch('ruamel.yaml.YAML.load', return_value={})
@patch('pypyr.loaders.file.get_pipeline_path',
return_value=Path('arb/path/x.yaml'))
def test_get_pipeline_definition_from_cache(mocked_get_path,
Expand All @@ -245,7 +245,7 @@ def test_get_pipeline_definition_from_cache(mocked_get_path,
'pipename', '/parent/dir')

assert pipeline_def_1 == pipeline_def_2 == PipelineDefinition(
'mocked pipeline def',
PipelineBody.from_mapping({}),
PipelineFileInfo(pipeline_name='x.yaml',
loader='pypyr.loaders.file',
parent=Path('arb/path'),
Expand All @@ -268,7 +268,7 @@ def test_get_pipeline_definition_from_cache(mocked_get_path,


@patch('pypyr.loaders.file.add_sys_path')
@patch('ruamel.yaml.YAML.load', return_value='mocked pipeline def')
@patch('ruamel.yaml.YAML.load', return_value={})
@patch('pypyr.loaders.file.get_pipeline_path',
return_value=Path('arb/path/x.yaml'))
def test_get_pipeline_definition_with_encoding(mocked_get_path,
Expand All @@ -284,7 +284,7 @@ def test_get_pipeline_definition_with_encoding(mocked_get_path,
'pipename', '/parent/dir')

assert pipeline_def == PipelineDefinition(
'mocked pipeline def',
PipelineBody.from_mapping({}),
PipelineFileInfo(pipeline_name='x.yaml',
loader='pypyr.loaders.file',
parent=Path('arb/path'),
Expand Down