Git Product home page Git Product logo

Comments (8)

aldanor avatar aldanor commented on August 11, 2024

Now that we switched to using pytest.main, we can mock/monkeypatch it?

from pytest-watch.

aldanor avatar aldanor commented on August 11, 2024

(Btw I would also refactor the code so that you don't have to pass a gazillion of parameters twice, first from main to watch and then to ChangeHandler, the watch itself could be a handler's method, why not?)

from pytest-watch.

aldanor avatar aldanor commented on August 11, 2024

I would use pytest/tox for testing and set up builds on travis and appveyor -- this way we'll test it on win/linux for all interpreter versions.

from pytest-watch.

joeyespo avatar joeyespo commented on August 11, 2024

Now that we switched to using pytest.main, we can mock/monkeypatch it

Interesting. Maybe. If it's our own custom monkey-patching code, it seems like a big place to make mistakes. I think integration tests are going to find many more bugs than unit tests in our case. We don't have too many functions to tests (but by all means, we should still test those).

For making sure that ptw --poll -- myfile still works though, it might make more sense not to try to go around py.test (since it's error prone), but use it in the tests so we're guaranteed that we haven't broken anything. Something that runs ptw top-level with a timeout and observes STDOUT.

Then we should also add tests for multiple ptw / py.test version combinations. So the combinations would be ptw version, py.test version, Linux | Mac | Windows, Python 2.7 | 3.2? | 3.3? | 3.4 | 3.5. (Let's only include earlier versions of 3 if we already support it :-)

What do you think?

Btw I would also refactor the code so that you don't have to pass a gazillion of parameters twice, first from main to watch and then to ChangeHandler, the watch itself could be a handler's method, why not?

Yeah, agreed. It's time to refactor.

from pytest-watch.

bendtherules avatar bendtherules commented on August 11, 2024

What if we just mock pytest.main as @aldanor said and check whether the parameters provided are correct? Good thing about mocking, we dont need much of our own code to prepare the mock.

With that said, our subprocess call to py.test probably wont pick up the mocked pytest.main, we need to subprocess call something like our mocked py.test-mock executable, by setting -runner

Also, some way to run pytest main loop just once instead of the infinite watching loop, using timeouts always is not desirable.

from pytest-watch.

apast avatar apast commented on August 11, 2024

Hello,

can I proceed with some tests over main and parameters parsing?

I want to try some tests on #65, but before I need some basic tests coverage to keep current plugin funcionality.

Do you have some WIP on this issue or can I start here from zero?

Initially, I aim to test only for Linux + python 3+.

Thanks.

from pytest-watch.

bendtherules avatar bendtherules commented on August 11, 2024

Maybe take a look at #37 ?
Added this small config tests long back, so please feel free to take over.

Short note regarding the PR:

  1. Please ignore test_works_directories_ini_option check - We decided to not do it - #41 .
  2. This only tests the config - doesn't ensure that ptw actually works with pytest - as mentioned above (#14 (comment))

Completely out of context now, but @joeyespo can suggest other things we need to fix there,

from pytest-watch.

apast avatar apast commented on August 11, 2024

Good!

I started from the basics before any step forward.

Initial test cases are being applied to CLI arguments, aiming to cover all pytest_watch.command file.

I agree with and am following #14 comment about focus on ptw functional, before integration. It sounds the best for the moment.

from pytest-watch.

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.