GithubHelp home page GithubHelp logo

Comments (8)

toddr avatar toddr commented on May 27, 2024

On load of Test::MockFile, we need to die if we detect $INC{'autodie.pm'}.

from test-mockfile.

FGasper avatar FGasper commented on May 27, 2024

@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.

toddr avatar toddr commented on May 27, 2024

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.

FGasper avatar FGasper commented on May 27, 2024

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.

atoomic avatar atoomic commented on May 27, 2024

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.

FGasper avatar FGasper commented on May 27, 2024

It may be better to wait until Leon’s autocroak module is usable than to try to fix this.

from test-mockfile.

FGasper avatar FGasper commented on May 27, 2024

https://github.com/cpanel/p5-Filesys-Restrict (private repo) would also address this, perhaps more neatly.

from test-mockfile.

tomgreen98 avatar tomgreen98 commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.