This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Refactor resources tests - integrate versions and improve test coverage #297
Merged
hayfield
merged 64 commits into
improve-version-parameter
from
refactor-resources-tests
Mar 22, 2018
Merged
Changes from all commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
8c1004d
Test that test data for various versions are being detected
hayfield 9c7999b
Merge branch 'improve-version-parameter' into 218ify-resource-version…
hayfield 86e2332
Add a fixture for specifying all standard versions, or independent
hayfield 9af9dea
Test the creation of Codelist resource paths
hayfield 351a74d
Rename a function
hayfield e9a4d71
Add a fixture to actually provide all versions of the IATI Standard
hayfield c3d8be0
Remove an 'X' from a class name
hayfield fb4f9b1
Move a create_x_path function to new class
hayfield 8b03b82
Merge branch 'minor-versions-constant' into 218ify-resource-create-x-…
hayfield 3c72578
Test the creation of Codelist Mapping file resource paths
hayfield ceef8a5
Fuzz the finding of a Codelist Mapping File path
hayfield 71110b5
Test that creation of Codelist paths raises relevant errors
hayfield 85499b8
Merge branch '218ify-resource-create-x-path' into 'improve-resource-v…
hayfield 7cad2b5
Make resources tests pass
hayfield a4b219b
Update documentation for permitted version arg values
hayfield 82d3491
Merge branch 'improve-version-parameter' into 'improve-resource-versi…
hayfield db320ed
Merge branch 'prevent-decimal-attr-error' into 'improve-resource-vers…
hayfield bea658c
Merge branch 'prevent-decimal-attr-error' into improve-resource-versi…
hayfield 1cf576b
Merge branch 'improve-version-parameter' into improve-resource-versio…
hayfield 2a28686
Improve testing of requesting Codelist Mapping resources
hayfield 01b403d
Fix decimalisation of invalid major versions
hayfield be2965a
Merge branch 'improve-version-parameter' into 'improve-resource-versi…
hayfield a3f8112
Actually save a file between resolving a merge conflict and committing
hayfield f12a6c0
Merge branch 'improve-version-parameter' into refactor-resources-tests
hayfield 263ff3a
Start full redesign of the resource module tests
hayfield c0292a3
Fix a docstring to refer to the correct variable name.
hayfield dd15e9f
Test the resources folder_name_for_version function
hayfield 032af8e
Test resource function folder_path_for_version
hayfield cfd1c48
Test the resource path_for_version function
hayfield c1e4e13
Merge branch 'improve-version-parameter' into refactor-resources-tests
hayfield dc51880
Provide improved checks on input paths
hayfield 2069da2
Re-order tests in test_resources
hayfield e5312c2
Test creation of paths to Ruleset resources
hayfield bada482
Remove a now-incorrect docstring statement.
hayfield ca6d35c
Test creation of paths for Schema resources
hayfield 21f12b8
Make use of a named tuple to increase test clarity
hayfield d15f7dd
More thoroughly test iati.resources.get_ruleset_paths()
hayfield b46c51c
Merge branch 'improve-version-parameter' into refactor-resources-tests
hayfield 96d9223
Remove a now-redundant test function
hayfield 4019cd7
Test that get_x_path() functions raise errors when given junk values
hayfield 89adb58
Test getting Schema resource paths
hayfield 1442cb5
Integrate the checks from old get_x_schema_paths checks
hayfield 3ab0d49
Migrate create_codelist_mapping tests to new format
hayfield fd2fb7b
Test get_codelist_mapping_paths in resources
hayfield 33b9eff
Remove default value for version arg on resources.get_x_paths functions
hayfield 8446fec
Update some out-of-date docstrings
hayfield c15554b
Update changelog with resources changes
hayfield c34c531
Fix linting errors
hayfield df07224
Perform some basic docstring improvements
hayfield 244203b
More thoroughly test resources.create_codelist_path()
hayfield 45c52b9
Test that appropraite errors are raised when decorating incorrect fun…
hayfield 9f9f728
standardise -> normalise
hayfield df13e9f
Test resources get_codelist_paths()
hayfield c114412
Tidy up some development placeholders
hayfield b26c2c6
Update documentation for iati.resources.get_codelist_paths()
hayfield 28aece8
Add PR numbers for resource test changelog items
hayfield 7ec75b1
Make test function names match what they are testing
hayfield 37cca6d
Remove default values for resource version args
hayfield f89e7f8
Remove now False statements from docstrings
hayfield 3782fd2
Add a pylint disable for missing parameter
hayfield 02d1433
Make review changes
hayfield c880a6e
Add a clarity comment based on review
hayfield d19a6df
Extract some common version functionality into a function
hayfield 2f62bf9
Test that create_codelist_mapping_path() TypeError-s correctly
hayfield File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""Pytest fixtures for obtaining filepaths.""" | ||
import os | ||
import pytest | ||
import iati.tests.utilities | ||
|
||
|
||
@pytest.fixture(params=[ | ||
'filename-no-extension', | ||
'filename-with-extension.ext', | ||
'FilenameMixedCase' | ||
]) | ||
def filename_no_meaning(request): | ||
"""Return a filename with no particular meaning.""" | ||
return request.param | ||
|
||
|
||
@pytest.fixture(params=[ | ||
'a-single-filename' | ||
]) | ||
def filename_no_meaning_single(request): | ||
"""Return a single filename with no particular meaning.""" | ||
return request.param | ||
|
||
|
||
@pytest.fixture(params=iati.tests.utilities.generate_test_types(['str'], True)) | ||
def filepath_invalid_type(request): | ||
"""Return a value that is of a type that cannot represent a filepath. | ||
|
||
Python2/3 compatibility: Look at using the concept of PathLike that was introduced at 3.4. | ||
""" | ||
return request.param | ||
|
||
|
||
@pytest.fixture | ||
def filepath_empty(): | ||
"""Return a value that is an empty filepath.""" | ||
return '' | ||
|
||
|
||
@pytest.fixture(params=[ | ||
' ', # whitespace only | ||
'\ntext-with-newline\n', # newline | ||
os.path.sep * 3 # multiple separators, each with nothing between them | ||
]) | ||
def filepath_invalid_value(request): | ||
"""Return a value that is a string that cannot represent a filepath.""" | ||
return request.param | ||
|
||
|
||
@pytest.fixture(params=[ | ||
'foldername' + os.path.sep, | ||
'foldername-with-hyphen' + os.path.sep, | ||
'folder' + os.path.sep + 'sub-folder' + os.path.sep | ||
]) | ||
def folderpath_no_meaning(request): | ||
"""Return a folder path with no particular meaning. Differs from a filepath in that it contains separators.""" | ||
return request.param |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sort of ugly list expansion definitely needs rectifying through use of a function that does it nicely!