Comments (8)
On load of Test::MockFile, we need to die if we detect $INC{'autodie.pm'}.
from test-mockfile.
@toddr: That seems a pretty aggressive approach. It assumes one part of a test won’t use the mock and another won’t use a temp directory.
Is it possible to work with it if there is “no autodie” local to the T::MF usage?
from test-mockfile.
I would have to provide an unimport and so would autodie if it doesn't already. That's a perfectly good phase 2 but that'd be a lot of work.
from test-mockfile.
Another problem with the idea of making autodie
mutually exclusive with this module is that autodie
also encompasses non-filesystem operations. I suspect it’s not uncommon, for example, for tests to create a pair of sockets via socketpair
and do tests on those. That’s a case where autodie
is useful but has nothing to do with T::MF.
from test-mockfile.
another example
╰─> perl -MTest::MockFile -E 'use autodie; my $f = q[/a/b/c]; my $m = Test::MockFile->file(q[/a/b/c] => 123); say q[ok] if -f $f; open(my $fh, "+<", $f ) or die $!'
ok
Can't open '/a/b/c' with mode '+<': 'No such file or directory' at -e line 1
from test-mockfile.
It may be better to wait until Leon’s autocroak module is usable than to try to fix this.
from test-mockfile.
https://github.com/cpanel/p5-Filesys-Restrict (private repo) would also address this, perhaps more neatly.
from test-mockfile.
Im wondering if this needs some effort to work with autodie and similar tools. More and more code we see is using patterns similar to autodie. Being able to mock the filesystem is much nicer than using a temp folder.
There has got to be a way to patch autodie to work with these mocks when Test::MockFile sees autodie or similar is loaded.
from test-mockfile.
Related Issues (20)
- Cannot use flock with mocked file
- Test::MockFileSys Prototype HOT 3
- Only show files within the directory HOT 2
- Setting time for a file does not change the time for a directory
- strict mode does not understand open with two args HOT 5
- Clean up the tests to remove localized error strings ($!) HOT 1
- Failing tests HOT 1
- Document how to allow loading the debugger
- t/readline.t fails on freebsd
- t/runtime-bareword-filehandles.t fails (sometimes) on 5.16.3
- Provide a way to mock a whole dir or tree.
- Test::MockFile symlinks does not play nice with Cwd... HOT 1
- Test::MockFile corrupts glob
- chmod() should ignore filehandle arguments HOT 2
- utime() isn’t covered in strict mode
- File::Temp::tempfile() in scalar context should create an unlinked file.
- Failed test '$! is EINVAL for a readlink(undef)'
- binmode is unimplemented - cannot use File::Copy with Test::MockFile HOT 2
- Home directory isn't properly supported
- Spooky action-at-a-distance
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from test-mockfile.