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

"Unable to delete" on Windows #3

Closed
jirinapravnik opened this issue Aug 11, 2016 · 13 comments
Closed

"Unable to delete" on Windows #3

jirinapravnik opened this issue Aug 11, 2016 · 13 comments

Comments

@jirinapravnik
Copy link
Contributor

I am getting almost on every run error "Unable to delete". Once it is file, then it is also directory temp/functional...

I tried to play with NetteDIModule.php and move code in _before() should be in _beforeSuite(), and _after() should be in _afterSuite(). And problem seems to be solved, only sometimes it get that error. I don't understand too much codeception, but IMHO current version of NetteDIModule rebuild container on each test, when I run full suite and it's expensive...

@enumag
Copy link
Collaborator

enumag commented Aug 11, 2016

I've never seen this error (and I'm in fact using windows), can you elaborate how to reproduce it or what kind of file it is?

As for container creation you're right about that. It's not easy to achieve though because you would have to keep generated DIC while clearing all other cached data for proper tests isolation.

EDIT: Or maybe we could make the tempDir clearing optional. Would that work for you?

@jirinapravnik
Copy link
Contributor Author

I am using also Doctrine and so DIC and cache folder is quite large. It is diferrent files or folder. Sometimes it also pass, but not so often.

I think it would be probably better to have optional clearing tempDir, or somethim like that. If i run my suite "as is" it lasts 2.23min. If I run it with my edited NetteDIModule (_afterSuite & _beforeSuite) it lasts 53 sec.

@enumag
Copy link
Collaborator

enumag commented Aug 11, 2016

Can you post your edited NetteDIModule for inspiration?

@jirinapravnik
Copy link
Contributor Author

I only moved code from
_after() to _afterSuite()
and _before() to _beforeSuite()

But it is probably solution for faster execution, not for "unable delete". If it helps, "unable delete" is caused by "permission denied".

@enumag
Copy link
Collaborator

enumag commented Aug 12, 2016

Can you test how fast it is if you rename the methods back to _before / _after and remove the FileSystem::delete() call in _before?

I'm afraid I can't help with unable delete without being able to reproduce it.

@jirinapravnik
Copy link
Contributor Author

Still slow. One test in suite takes about 14sec. In my edited NetteDIModule takes about 5sec (except first, because it must generate cache folder and DIC).

I understand, but it is interesting, you have never seen this error... Have you ever tried run it in larger application - in my case - 400 services & 65 entities?

@enumag
Copy link
Collaborator

enumag commented Aug 15, 2016

That's odd. Can you determine why Nette recompiles the container after that change? (Presuming that's what is slowing the tests down.)

Probably not as large as yours.

Also don't take my "never saw this error" too seriously. It's quite possible I just forgot.

@jirinapravnik
Copy link
Contributor Author

IMHO it recompiles due to _after - there is also FileSystem::delete ... And _after is called IMHO after each test function

@enumag
Copy link
Collaborator

enumag commented Aug 16, 2016

Oh of course. Remove the delete from after as well. Then it should be fast.

@jirinapravnik
Copy link
Contributor Author

Only a bit faster, problem is also $this->container = null; in _before(). If i remove this, it is fast like my edited file.

@enumag
Copy link
Collaborator

enumag commented Aug 16, 2016

$this->container = null; is something I'd like to keep. Reusing the same container for all tests can lead to all sorts of problems. I'm trying to achieve a point where the container is created but not generated for every test. Which should be the case after removing the FileSystem::delete calls. - I don't understand why it is still slow.

@enumag
Copy link
Collaborator

enumag commented Sep 1, 2016

@jirinapravnik After some thought I want to add an option for reusing the container. Perhaps even make it default in some future version. Can you send a PR?

@enumag
Copy link
Collaborator

enumag commented Feb 8, 2017

@jirinapravnik Please check if the new option works for you. I can add this to v0.7.x as well if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants