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

add pyyaml to test_require #2047

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add pyyaml to test_require #2047

wants to merge 1 commit into from

Conversation

LuiggiTenorioK
Copy link
Member

@LuiggiTenorioK LuiggiTenorioK commented Dec 23, 2024

PR to fix our CI pipeline because pyyaml is not installed indirectly anymore by one of our dependencies and is used inside test_rocrate.py.

I tried to change it to ruamel.yaml by doing:

diff --git a/test/unit/provenance/test_rocrate.py b/test/unit/provenance/test_rocrate.py
index 8e0b4e1c..134c4190 100644
--- a/test/unit/provenance/test_rocrate.py
+++ b/test/unit/provenance/test_rocrate.py
@@ -6,7 +6,8 @@ from subprocess import CalledProcessError
 from tempfile import TemporaryDirectory
 from unittest import TestCase
 
-import yaml
+from io import StringIO
+from ruamel.yaml import YAML
 from mock import Mock, patch
 from rocrate.rocrate import File
 from rocrate.rocrate import ROCrate
@@ -48,7 +49,10 @@ class TestRoCrate(TestCase):
         Path(conf_dir, 'metadata').mkdir()
         unified_config = Path(conf_dir, 'metadata/experiment_data.yml')
         unified_config.touch()
-        unified_config.write_text(yaml.dump(as_conf.experiment_data))
+        stream = StringIO()
+        YAML().dump(as_conf.experiment_data, stream)
+        yaml_string = stream.getvalue()
+        unified_config.write_text(yaml_string)
         as_conf.current_loaded_files = {unified_config: 0}
 
     def test_add_dir_and_files_empty_folder(self):

but ruaml.yaml prevents you to write a in the file with an arbitrary object type which is necessary for the TestRoCrate::test_rocrate_invalid_parameter_type test. Alternatively, I added pyyaml to the test_require as the easiest solution.

@LuiggiTenorioK LuiggiTenorioK self-assigned this Dec 23, 2024
@LuiggiTenorioK LuiggiTenorioK marked this pull request as ready for review December 23, 2024 13:59
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.92%. Comparing base (3706cb9) to head (2ca9935).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2047   +/-   ##
=======================================
  Coverage   48.92%   48.92%           
=======================================
  Files          72       72           
  Lines       17543    17543           
  Branches     3415     3415           
=======================================
  Hits         8583     8583           
  Misses       8156     8156           
  Partials      804      804           
Flag Coverage Δ
fast-tests 48.92% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LuiggiTenorioK LuiggiTenorioK requested a review from kinow December 23, 2024 13:59
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.

2 participants