From b29cfbc3cef4e10f5f5b3ded03bdd6f388800dba Mon Sep 17 00:00:00 2001 From: IanCa Date: Fri, 14 Jun 2024 13:55:37 -0500 Subject: [PATCH 1/2] Fix script_util tests --- tests/scripts/test_script_util.py | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/scripts/test_script_util.py b/tests/scripts/test_script_util.py index f87feccc..55989be1 100644 --- a/tests/scripts/test_script_util.py +++ b/tests/scripts/test_script_util.py @@ -31,6 +31,38 @@ def test_none_extension(self): class TestSortBaseSchemas(unittest.TestCase): + TEST_DIR = 'test_directory' + + @classmethod + def setUpClass(cls): + if not os.path.exists(cls.TEST_DIR): + os.makedirs(cls.TEST_DIR) + os.chdir(cls.TEST_DIR) + cls.create_stub_files() + + @classmethod + def tearDownClass(cls): + os.chdir('..') + shutil.rmtree(cls.TEST_DIR) + + @classmethod + def create_stub_files(cls): + filenames = [ + "test_schema.mediawiki", + os.path.normpath("hedtsv/test_schema/test_schema_Tag.tsv"), + "other_schema.xml", + os.path.normpath("hedtsv/wrong_folder/wrong_name_Tag.tsv"), + os.path.normpath("prerelease/hedtsv/test_schema/test_schema_Tag.tsv"), + os.path.normpath("not_hedtsv/test_schema/test_schema_Tag.tsv") + ] + for filename in filenames: + filepath = os.path.normpath(filename) + directory = os.path.dirname(filepath) + if directory: + os.makedirs(directory, exist_ok=True) + with open(filepath, 'w') as f: + f.write('') # Create an empty file + def test_mixed_file_types(self): filenames = [ "test_schema.mediawiki", From 258b1ab21ec8861714af660fbdfa53e3f6f31c5c Mon Sep 17 00:00:00 2001 From: IanCa Date: Fri, 14 Jun 2024 15:02:35 -0500 Subject: [PATCH 2/2] Swap a test from score 1.1.1 to score 1.1.0 --- tests/schema/test_hed_schema_io_df.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/schema/test_hed_schema_io_df.py b/tests/schema/test_hed_schema_io_df.py index bf59dbc1..d8d37059 100644 --- a/tests/schema/test_hed_schema_io_df.py +++ b/tests/schema/test_hed_schema_io_df.py @@ -24,7 +24,7 @@ def test_saving_default_schemas(self): reloaded_schema = load_schema(self.output_folder + "test_8.tsv") self.assertEqual(schema, reloaded_schema) - schema = load_schema_version("score_1.1.1") + schema = load_schema_version("score_1.1.0") schema.save_as_dataframes(self.output_folder + "test_score.tsv", save_merged=True) reloaded_schema = load_schema(self.output_folder + "test_score.tsv")