Repository navigation
Rake::TestTask raises an error when the test path includes non-ascii characters on Windows #332
Description
Activity
I think the cause of this error is Ruby's bug.
The
Rake::TestTaskjob is executing an external ruby process.
The external process callsrake_test_loader.rbwith ruby's command-Ioption.
When the current directory path includes non-ascii character,requirefails because of ruby's bug reported below.Non-ASCII characters in the path to ruby executable break require paths
https://bugs.ruby-lang.org/issues/9737A case "require" fails when current directory path contains Japanese character
https://bugs.ruby-lang.org/issues/13863#note-5Do you still have this problem? Could you check whether #357 fixes it?
Reacted by masa kunikata@deivid-rodriguez
Thank you for your reply!!!It seems that the error occurs even with the #357 patch.
Though the error message is different from the original one,
I think the root cause is the same and it lies in Ruby itself.
Summary
current dir -> Non ascii path
"あいうえお"Ascii path
"abcde"rake v13.0.1 Error
File does not exist: targetOK rake v13.0.1
patched #357 PRError
cannot load such file -- target (LoadError)OK
Details
-
Non ascii path current directory
C:\temp\rake_test_task_non_ascii_path\あいうえお>rake
(Error) rake v13.0.1
C:/Ruby26-x64/bin/ruby.exe -w -I"lib;lib;test" -I"C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib" "C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_test_loader.rb" "test/target_test.rb"
File does not exist: target
rake aborted!
Command failed with status (1): [ruby -w -I"lib;lib;test" -I"C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib" "C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_test_loader.rb" "test/target_test.rb" ]Tasks: TOP => default => tsk
(See full trace by running task with --trace)(Error) rake v13.0.1 patched #357 PR
C:/Ruby26-x64/bin/ruby.exe -w -I"lib;lib;test" -rC:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_test_loader "test/target_test.rb" Traceback (most recent call last): 2: from test/target_test.rb:2:in `' 1: from C:/Ruby26-x64/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' C:/Ruby26-x64/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- target (LoadError) rake aborted! Command failed with status (1): [ruby -w -I"lib;lib;test" -rC:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_test_loader "test/target_test.rb" ] Tasks: TOP => default => tsk (See full trace by running task with --trace)-
Ascii path current directory
C:\temp\rake_test_task_non_ascii_path\abcde>rake
(OK) rake v13.0.1
C:/Ruby26-x64/bin/ruby.exe -w -I"lib;lib;test" -I"C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib" "C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_test_loader.rb" "test/target_test.rb" Loaded suite C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_test_loader Started . Finished in 0.0015035 seconds. ------------------------------------------------------------------------------------------------------------------------ 1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed ------------------------------------------------------------------------------------------------------------------------ 665.11 tests/s, 665.11 assertions/s
(OK) rake v13.0.1 patched #357 PR
C:/Ruby26-x64/bin/ruby.exe -w -I"lib;lib;test" -rC:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/rake_test_loader "test/target_test.rb" Loaded suite test/target_test Started . Finished in 0.0012415 seconds. ------------------------------------------------------------------------------------------------------------------------ 1 tests, 1 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed ------------------------------------------------------------------------------------------------------------------------ 805.48 tests/s, 805.48 assertions/s
-
Right, I figured that would be the case, but since the crashing code is no longer hit with #357 I figured it was worth trying just to make sure! In any case, it wouldn't have really fixed the root cause, only circumvent it.
I hope your issue gets fixed!
Reacted by Dimitri ArrigoniReacted by masa kunikata
When a test file path includes non-ascii characters, rake test task
Rake::TestTaskfails with a messageIt seems the task can't find a file with non-ascii path on Windows.
Summary page including a procedure for reproducing
https://github.com/masa-kunikata/rake_test_task_non_ascii_path