Git Product home page Git Product logo

Comments (6)

henning avatar henning commented on August 11, 2024

see this commit:
henning@aeca1de

and this doc about using the assertRaises with "with":
http://docs.python.org/2/library/unittest.html#unittest.TestCase.assertRaises

from djangocms-installer.

yakky avatar yakky commented on August 11, 2024

Ok, that's the road to take.
Plus, it's a case-by-case thing, because not every text error is encapsulated in an exception message.
For instance, in tests.config.TestConfig.test_invalid_choices the error is in self.stderr so the assert should be something like:

self.assertTrue(self.stderr.getvalue().find("--cms-version/-v: invalid choice: '2.6'") > -1)

In these cases, we'd need to split a single test in multiple ones (e.g.: test_invalid_project_name must be split in test_invalid_project_name_1, test_invalid_project_name_2 ... or clean the local stdout / stderrattributes after each sub-test

from djangocms-installer.

yakky avatar yakky commented on August 11, 2024

Error messages moved to stderr with #37
Thus in test_invalid_* tests assertion is against self.stderr while in test_check_install the current form is correct, provided the assertion are unindented outside the context manager scope

from djangocms-installer.

yakky avatar yakky commented on August 11, 2024

mock.patch "redirects" the default stdout / stderr to the StringIO objects, so we can actually read them and check them for correct messages (or suppress the output like in test_check_install)

from djangocms-installer.

henning avatar henning commented on August 11, 2024

OK! Well I've been thinkig it should work in this direction but I got something wrong, maybe checking stdout / sdterr...

If you're not already working on it, I can prepare the final fix with the adjusted asserts now

from djangocms-installer.

henning avatar henning commented on August 11, 2024

FYI: couldn't wait, I am at it now ;)

from djangocms-installer.

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.