diazona/setuptools-pyproject-migration

Inconsistent handling of authors without email addresses

diazona opened this issue · 1 comments

When running tests/distribution/test_distribution_packages.py::TestExternalProject::test_authors[pytest==7.3.0], setuptools-pyproject-migration uses None to represent the absence of an email address, whereas the test support code uses an empty string. (Unless I got those backwards?) We should make them consistent.

self = <test_distribution_packages.TestExternalProject object at 0x7f32b0cb4490>
expected = StandardMetadata(name='pytest', version=<Version('7.3.0')>, description='pytest: simple powerful testing with Python',...are Development :: Testing', 'Topic :: Utilities'], keywords=['test,unittest'], scripts={}, gui_scripts={}, dynamic=[])
actual = StandardMetadata(name='pytest', version=<Version('7.3.0')>, description='pytest: simple powerful testing with Python',..., 'unittest'], scripts={'pytest': 'pytest:console_main', 'py.test': 'pytest:console_main'}, gui_scripts={}, dynamic=[])

    def test_authors(self, expected: StandardMetadata, actual: StandardMetadata):
>       assert expected.authors == actual.authors
E       AssertionError: assert [('Holger Krekel', ''), ('Bruno Oliveira', ''), ('Ronny Pfannschmidt', ''), ('Floris Bruynooghe', ''), ('Brianna Laugher', ''), ('Florian Bruhin and others', '')] == [('Holger Krekel', None), ('Bruno Oliveira', None), ('Ronny Pfannschmidt', None), ('Floris Bruynooghe', None), ('Brianna Laugher', None), ('Florian Bruhin and others', None)]
E         At index 0 diff: ('Holger Krekel', '') != ('Holger Krekel', None)
E         Full diff:
E           [
E         -  ('Holger Krekel', None),
E         ?                    ^^^^
E         +  ('Holger Krekel', ''),
E         ?                    ^^
E         -  ('Bruno Oliveira', None),
E         ?                     ^^^^
E         +  ('Bruno Oliveira', ''),
E         ?                     ^^
E         -  ('Ronny Pfannschmidt', None),
E         ?                         ^^^^
E         +  ('Ronny Pfannschmidt', ''),
E         ?                         ^^
E         -  ('Floris Bruynooghe', None),
E         ?                        ^^^^
E         +  ('Floris Bruynooghe', ''),
E         ?                        ^^
E         -  ('Brianna Laugher', None),
E         ?                      ^^^^
E         +  ('Brianna Laugher', ''),
E         ?                      ^^
E         -  ('Florian Bruhin and others', None),
E         ?                                ^^^^
E         +  ('Florian Bruhin and others', ''),
E         ?                                ^^
E           ]

/home/diazona/programming/setuptools-pyproject-migration/tests/distribution/test_distribution_packages.py:155: AssertionError

I seem to remember having to make the test support code use a string in a couple places rather than None to satisfy type checking, or something like that, but I'm not sure. None is probably a better representation of the absence of an email address if we can do it.

I noticed that StandardMetadata.authors (and .maintainers) actually do require strings for the name and email address, but even that project is not consistent since it will use None for an absent email address. So the most proper fix here probably depends on how that inconsistency should be resolved. I'll see what they say (assuming I get a reply soon) and then we can proceed accordingly.