Fix failing test on Windows Platform (#11589)
* add separator for windows * fixes test_is_copy_consistent on Windows * fixing writing encoding issue on extended test (for Windows) * resolving comments
This commit is contained in:
@@ -571,7 +571,7 @@ def main():
|
|||||||
)
|
)
|
||||||
predictions = [pred.strip() for pred in predictions]
|
predictions = [pred.strip() for pred in predictions]
|
||||||
output_prediction_file = os.path.join(training_args.output_dir, "generated_predictions.txt")
|
output_prediction_file = os.path.join(training_args.output_dir, "generated_predictions.txt")
|
||||||
with open(output_prediction_file, "w") as writer:
|
with open(output_prediction_file, "w", encoding="utf-8") as writer:
|
||||||
writer.write("\n".join(predictions))
|
writer.write("\n".join(predictions))
|
||||||
|
|
||||||
if training_args.push_to_hub:
|
if training_args.push_to_hub:
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class Wav2Vec2TokenizerTest(unittest.TestCase):
|
|||||||
tokenizer_files = tokenizer.save_pretrained(tmpdirname2)
|
tokenizer_files = tokenizer.save_pretrained(tmpdirname2)
|
||||||
self.assertSequenceEqual(
|
self.assertSequenceEqual(
|
||||||
sorted(tuple(VOCAB_FILES_NAMES.values()) + ("special_tokens_map.json", "added_tokens.json")),
|
sorted(tuple(VOCAB_FILES_NAMES.values()) + ("special_tokens_map.json", "added_tokens.json")),
|
||||||
sorted(tuple(x.split("/")[-1] for x in tokenizer_files)),
|
sorted(tuple(x.split(os.path.sep)[-1] for x in tokenizer_files)),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Checks everything loads correctly in the same way
|
# Checks everything loads correctly in the same way
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class CopyCheckTester(unittest.TestCase):
|
|||||||
expected = comment + f"\nclass {class_name}(nn.Module):\n" + overwrite_result
|
expected = comment + f"\nclass {class_name}(nn.Module):\n" + overwrite_result
|
||||||
code = black.format_str(code, mode=black.FileMode([black.TargetVersion.PY35], line_length=119))
|
code = black.format_str(code, mode=black.FileMode([black.TargetVersion.PY35], line_length=119))
|
||||||
fname = os.path.join(self.transformer_dir, "new_code.py")
|
fname = os.path.join(self.transformer_dir, "new_code.py")
|
||||||
with open(fname, "w") as f:
|
with open(fname, "w", newline="\n") as f:
|
||||||
f.write(code)
|
f.write(code)
|
||||||
if overwrite_result is None:
|
if overwrite_result is None:
|
||||||
self.assertTrue(len(check_copies.is_copy_consistent(fname)) == 0)
|
self.assertTrue(len(check_copies.is_copy_consistent(fname)) == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user