Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8523007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:17:18+00:00 2026-06-11T07:17:18+00:00

I’m currently issuing a problem with running tests with rspec. All the test files

  • 0

I’m currently issuing a problem with running tests with rspec. All the test files (*_spec.rb) may run successfully. In same rare cases an error — Errno::EACCES may appear and one of the tests may fail. E.g:
All the test in the file *_spec.rb run:

  1. Successfully.
  2. Successfully.
  3. One the test had failed.
  4. Successfully.
  5. One the test had failed (not the same as in #3).
  6. etc.

The exception raises from the lines like:

  1. FileUtils.mv
  2. FileUtils.mkdir_p
  3. FileUtils.rm_r

All of those list work with files or directories and are used many times in tests. I.e.:
create folder(with subfolders, with files, etc.), rename folder, test something, delete.. and so on.

It looks like the problem is hidden somewhere in “timing”(if something is not done yet and another action tries to access that something). That mind comes from:

begin
  FileUtils.mv(a, b) # if an `Errno:EACCESS` was raised here
rescue               #
  FileUtils.mv(a, b) # it wouldn't be raised now
end

The question is:
How can it be fixed? (i mean Errno:EACCESS which is reproduced rarely and some tests)


  • Adding sleep after every operation with files is not acceptable nevertheless it will help.
  • ruby’s methods (FileUtils.(mv|rm_r|mkdir_p)) may be modified to retry once on Errno::EACCES but is this the best solution?

P.S.
Sorry for my English and feel free to ask any question as i’ve tried to explain as brief as i could. Thanks in advanced, at least for you’ve read this to the end;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:17:20+00:00Added an answer on June 11, 2026 at 7:17 am

    Look for the root cause, don’t succumb to workarounds you mentioned.

    First make sure you’re using before and after for setting up and tearing down file fixtures. If you code your setup and teardown procedures in the spec itself you run a risk of it not running when the test fails.

    Second, make sure your setup & teardown procedures create different files and directories for each test. If all you’re doing is reading it’s ok to use shared fixtures, but for all other things (moving, creation, appending, deletion) use a fresh file/directory. The best thing to do is to use freshly generated temporary files and directories. It will make your tests independent, even allowing to run them in parallel.

    Third, check what other processes may use files created/used by your tests. I don’t know your setup, and it all depends on that, but possible things are web servers, browsers (e.g. via selenium), mail servers, etc. Simply check what other processes are you running as a part of your build.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.