-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add findns: directive to config #1420
Conversation
@pganssle Have a look and tell me if that is the right direction. I so, I will continue with implementing required tests. |
Is there a reason it can't be |
@pganssle can we handle this in a different issue/PR? |
As for the directive, sure, this I can rename right now. |
42c3da2
to
81ae059
Compare
The |
This seems like it will work, but the implementation might be a bit cleaner if you do this: directive = value.split(':', 1)[0]
if directive not in {'find', 'find_namespace'}:
... |
@pganssle good point, but this will be a different commit |
@pganssle note that with the latest commit I refrained from using string.split() and instead used value.strip(). and maybe even this op is redundant as the parser might have normalized the value already, but we can never know... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things
docs/setuptools.txt
Outdated
@@ -2389,8 +2389,8 @@ Metadata and options are set in the config sections of the same name. | |||
* In some cases, complex values can be provided in dedicated subsections for | |||
clarity. | |||
|
|||
* Some keys allow ``file:``, ``attr:``, and ``find:`` directives in order to | |||
cover common usecases. | |||
* Some keys allow ``file:``, ``attr:``, and ``find:`` and ``find_namespace:`` directives i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will look into this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
setuptools/config.py
Outdated
if not value.startswith(find_directive): | ||
return self._parse_list(value) | ||
if not trimmed_value in find_directives: | ||
return self._parse_list(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad indentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops nice find
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and there was even more where this came from...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
setuptools/config.py
Outdated
|
||
return find_packages(**find_kwargs) | ||
|
||
def parse_section_packages__find(self, section_options): | ||
"""Parses `packages.find` configuration file section. | ||
"""Parses `packages.find[ns]` configuration file section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this really use a packages.findns
section? The tests do not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice find, fixing right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
setuptools/tests/test_config.py
Outdated
' fake_package.sub_one\n' | ||
) | ||
with get_dist(tmpdir) as dist: | ||
assert set(dist.packages) == set( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use a set literal here. Python 2.6 support was dropped in v37.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other tests also use the non set literal, should I proceed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
If you comply to the changes, I will proceed with fixing #1421 based upon these changes. |
setuptools/tests/test_config.py
Outdated
|
||
py2_only = pytest.mark.xfail(not PY2, reason="Test runs on Python 2 only") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these should be pytest.mark.skip
, not xfail
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will have to fix the tests for find_packages_ns as well. you would want to fix the other tests that use that pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
six.PY2 seems to fail when marking tests for specific versions
SKIP [1] setuptools/tests/test_config.py:604: Test runs on Python 2 only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's indicating that the test was skipped. When you mark something xfail
, it actually runs the test and ignores the result if it fails (or if you make it a strict xfail, actually fails the test suite if the test passes). skip
doesn't run the test at all, so I believe that message is expected.
You are right that we should be switching many xfail
s over to skip
. I was planning on doing that at some point, but it takes time to figure out which ones are intended as an actual xfail
(which generally means "this should work but it's a known bug - when this test starts passing drop this decorator") and which are just using the wrong decorator for skip
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks alright now!
currently working on py2_only/py3_only for test_config. It does not seem to work as expected, reporting false results. tomorrow will be a new day... |
@silkentrance That's my mistake, the correct mark is |
I pushed an updated version with the proper decorator to your branch. |
@pganssle thanks. I did find out about skipif in the morning, too. Yesterday I was way too tired... |
I have refactored out the markers for py2/py3 into tests/init.py since they had been redeclared. Other test modules can be refactored, too, but I leave it at that for the time being. |
* fix #1419 PEP420: add find_namespace: directive * fix #1419 PEP420: add find_namespace: directive to documentation * fix #1419 PEP420: add tests * fix #1419 PEP420: clean up code * fix #1419 PEP420: fix typo in documentation * fix #1419 PEP420: fix typo in documentation * fix #1419 PEP420: clean up code * fix #1419 PEP420: add changelog entry * fixup! fix #1419 PEP420: add tests * fix #1419 PEP420: cleanup code refactor markers * #1420: Rename find_namespace_ns to find_namespace_packages * #1420: update changelog entry
Summary of changes
findns:
directivefindns:
directiveCloses #1419
Pull Request Checklist