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

Adding the ability to specify the yaml loader in the file_data decorator #77

Merged
merged 6 commits into from
Mar 10, 2020
Merged

Conversation

skeletorXVI
Copy link

In some cases it is necessary to test with actual python objects. pyyaml actually supports deserialization into objects by using yaml tags but only when using the pyyaml.FullLoader. pyyaml recommends the use of the load_safe method for security reasons in most cases, which disables python specific tags and has been used here.

By adding a parameter to pass a different loader, while defaulting to the safe_load method, I created the possibility to customize the deserialization for specific tests, while retaining the previous behavior.

@codecov-io
Copy link

codecov-io commented Feb 21, 2020

Codecov Report

Merging #77 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #77   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines         122    128    +6     
=====================================
+ Hits          122    128    +6
Impacted Files Coverage Δ
ddt.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fdbaff8...371a22e. Read the comment docs.

@wswld wswld self-requested a review February 26, 2020 01:35
@wswld wswld self-assigned this Mar 4, 2020
Copy link
Contributor

@wswld wswld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty neat. I think it could be cool to support that. There are a couple of minor issues with the pull request though. Please have a look at them and we'll get this merged.

.travis.yml Show resolved Hide resolved
ddt.py Outdated Show resolved Hide resolved
test/test_custom_yaml_loader.yaml Outdated Show resolved Hide resolved
test/test_functional_custom_tags.yaml Outdated Show resolved Hide resolved
…s to data folder; add missing new line in test_functional_custom_tags.yaml
@wswld wswld self-requested a review March 10, 2020 02:00
Copy link
Contributor

@wswld wswld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good. Thanks

@wswld wswld merged commit f2ba014 into datadriventests:master Mar 10, 2020
wswld added a commit that referenced this pull request Mar 10, 2020
Adding the ability to specify the yaml loader in the file_data decorator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants