Giter Club home page Giter Club logo

Comments (11)

eumiro avatar eumiro commented on August 16, 2024 1

@alexanderankin of course you can keep the test classes.

When unittest encounters assert expr, it only says the expr is but does not analyze the expression. That's what all those self.assertSomething methods are for. pytest analyzes the expression. That's why the switch would have to be planned and there's (almost) no way back to the stdlib unittest.

I am just asking whether you're considering it. Today I have also tried to introduce pathlib.Path for all directory/files operations, but in the tests that would be too much overhead without using the tmp_path fixture from pytest.

from fpdf2.

eumiro avatar eumiro commented on August 16, 2024 1

It does catch assert errors:

assert x > y, "wrong order

will tell you wrong order

But if you give pytest

assert x > y

it will print the values of x and y as well.

from fpdf2.

alexanderankin avatar alexanderankin commented on August 16, 2024 1

there seems to be a consensus in the python community on pytest lol. I use java at work, so i see lots of the self.assertEquals and hamcrest methods (without the self, though b/c its java). I think pytest overall is the right move in order to keep it going. according to the internet this is worthwhile.

from fpdf2.

Lucas-C avatar Lucas-C commented on August 16, 2024 1

Thank you very much for the time you are taking in improving fpdf2 tests!

I see you already opened a PR: #80 😮

Awesome! I'm going to comment on it & continue the discussion there

from fpdf2.

alexanderankin avatar alexanderankin commented on August 16, 2024

from fpdf2.

Lucas-C avatar Lucas-C commented on August 16, 2024

I think switching to assert will break compatibility with unittest.

I'm used to pytest and I know the many useful features it would provide, so I'm favorable overall.

However @alexanderankin has been maintaining this project for longer than I have, and I'd prefer not to operate this change if he's not comfortable with it 😉

from fpdf2.

alexanderankin avatar alexanderankin commented on August 16, 2024

from fpdf2.

alexanderankin avatar alexanderankin commented on August 16, 2024

from fpdf2.

Lucas-C avatar Lucas-C commented on August 16, 2024

Great!
Let's go with pytest then!

@eumiro are you volunteering to do the transition? 😊

from fpdf2.

eumiro avatar eumiro commented on August 16, 2024

Great!
Let's go with pytest then!

@eumiro are you volunteering to do the transition? blush

I can certainly help you to prepare the directories and start the migration, but then it looks like a nice bunch of good-first-issues for other contributors.

I'd propose to create a new directory tests with the subdirectory testdata and in a new branch start copying the tests and their test data there. Once it's done, the old test directory can be removed and after the merge the CI will run the new tests.

from fpdf2.

Lucas-C avatar Lucas-C commented on August 16, 2024

Done in #82

Closing this

from fpdf2.

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.