-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2588 from melissa-kun-li/compatibility-dash-method
Provide support for dash-separated keys in setup.cfg, warns for future incompatibility of certain keys
- Loading branch information
Showing
5 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Removed the conversion of dashes to underscores in the :code:`extras_require` and :code:`data_files` of :code:`setup.cfg` to support the usage of dashes. Method will warn users when they use a dash-separated key which in the future will only allow an underscore. Note: the method performs the dash to underscore conversion to preserve compatibility, but future versions will no longer support it -- by :user:`melissa-kun-li` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,8 +210,8 @@ def test_aliases(self, tmpdir): | |
fake_env( | ||
tmpdir, | ||
'[metadata]\n' | ||
'author-email = [email protected]\n' | ||
'home-page = http://test.test.com/test/\n' | ||
'author_email = [email protected]\n' | ||
'home_page = http://test.test.com/test/\n' | ||
'summary = Short summary\n' | ||
'platform = a, b\n' | ||
'classifier =\n' | ||
|
@@ -507,6 +507,25 @@ def test_not_utf8(self, tmpdir): | |
with get_dist(tmpdir): | ||
pass | ||
|
||
def test_dash_to_underscore_warning(self, tmpdir): | ||
# dash_to_underscore_warning() is a method in setuptools.dist | ||
# remove this test and method when dash convert to underscore in setup.cfg | ||
# is no longer supported | ||
fake_env( | ||
tmpdir, | ||
'[metadata]\n' | ||
'author-email = [email protected]\n' | ||
'maintainer_email = [email protected]\n' | ||
) | ||
msg = ("Usage of dash-separated 'author-email' will not be supported " | ||
"in future versions. " | ||
"Please use the underscore name 'author_email' instead") | ||
with pytest.warns(UserWarning, match=msg): | ||
with get_dist(tmpdir) as dist: | ||
metadata = dist.metadata | ||
assert metadata.author_email == '[email protected]' | ||
assert metadata.maintainer_email == '[email protected]' | ||
|
||
|
||
class TestOptions: | ||
|
||
|
@@ -772,6 +791,20 @@ def test_extras_require(self, tmpdir): | |
} | ||
assert dist.metadata.provides_extras == set(['pdf', 'rest']) | ||
|
||
def test_dash_preserved_extras_require(self, tmpdir): | ||
fake_env( | ||
tmpdir, | ||
'[options.extras_require]\n' | ||
'foo-a = foo\n' | ||
'foo_b = test\n' | ||
) | ||
|
||
with get_dist(tmpdir) as dist: | ||
assert dist.extras_require == { | ||
'foo-a': ['foo'], | ||
'foo_b': ['test'] | ||
} | ||
|
||
def test_entry_points(self, tmpdir): | ||
_, config = fake_env( | ||
tmpdir, | ||
|