py-pdf / pdfly

CLI tool to extract (meta)data from PDF and manipulate PDF files
BSD 3-Clause "New" or "Revised" License
108 stars 18 forks source link

TST: Adding unit tests #28

Closed Lucas-C closed 1 year ago

Lucas-C commented 1 year ago

I introduced the unit tests I originally developped in https://github.com/py-pdf/pypdf/pull/2170

I also added a pytest -vv execution as part of the GitHub Actions pipeline

Lucas-C commented 1 year ago

@MartinThoma: I think you added a dependency to fpdf2 in https://github.com/py-pdf/pdfly/blob/main/pdfly/x2pdf.py#L6

But this dependency was not declared in https://github.com/py-pdf/pdfly/blob/main/pyproject.toml#L31

Which is why the unit tests are currently failing in the GitHub Actions pipeline:

Run pytest -vv
ImportError while loading conftest '/home/runner/work/pdfly/pdfly/tests/conftest.py'.
tests/conftest.py:6: in <module>
    from pdfly.cli import entry_point
pdfly/cli.py:19: in <module>
    import pdfly.x2pdf
pdfly/x2pdf.py:6: in <module>
    from fpdf import FPDF
E   ModuleNotFoundError: No module named 'fpdf'

If you agree, I can add fpdf2 to pdfly dependencies as part of this PR

MartinThoma commented 1 year ago

@Lucas-C Thank you for the many improvements :pray:

The PR looks awesome :tada:

One last question before we merge it: Where do the images come from?

Lucas-C commented 1 year ago

The images come from https://github.com/py-pdf/fpdf2/tree/master/test/image/image_types:

MartinThoma commented 1 year ago

Very nice! Thank you :pray:

Lucas-C commented 1 year ago

Thank you!

Now I'll have to fix those xfail-ing tests... 😅

We could also open issues with the hacktoberfest tag in order to invite contributors this month: https://hacktoberfest.com/

MartinThoma commented 1 year ago

I like the idea of inviting new contributors :-) I would need to check what is required by us if we do that. I have no idea.

Lucas-C commented 1 year ago

I like the idea of inviting new contributors :-) I would need to check what is required by us if we do that. I have no idea.

I added a few issues with the hacktoberfest tag: https://github.com/py-pdf/pdfly/labels/hacktoberfest