-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 script to check duplicates entry in path #15263
Conversation
please rebase on top on current master, to provide a PR with a single commit 67963d8 Please see the travis log to see the reason of the failure |
e922faa
to
6e4c29a
Compare
fixed and passed test, but that's strange, because the test should be failed. |
ok, fixed, now it fails as expected, https://travis-ci.org/ros/rosdistro/builds/244168788?utm_source=github_status&utm_medium=notification
|
2307ccf
to
a8bddd7
Compare
a8bddd7
to
c68da8d
Compare
@mikaelarguedas @tfoote ik, now we passed the travis test so ready fo a reivew,
https://travis-ci.org/ros/rosdistro/builds/251355160 I have to install python-rosdep to run this feature, but I am not confident in this implementation, if someone know better way, let me know. |
scripts/check_duplicates.py
Outdated
|
||
|
||
def print_err(msg): | ||
printc(' ERR: ' + msg, 'red') |
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 would rather avoid adding this colorization logic just for this test. None of the other tests does it either.
scripts/check_duplicates.py
Outdated
print_test('checking with %s'%(matcher.tags)) | ||
sources = [x for x in sources if matcher.matches(x)] | ||
ret = ret & check_duplicates(sources) | ||
return ret |
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.
Please return an integer from the main
function which represents an error code or 0
if successful.
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.
revert this commit 00fd688
It seems nosetest need to return True or False, not integer,
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 am not sure I can follow: how is the main
function being called from nosetests
? nosetests
should only pick up the test functions defined in rosdep_duplicates_test.py
.
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.
@dirk-thomas yes and I called main
as check_duplicates
at the last of rosdep_duplicates_test.py
https://github.com/ros/rosdistro/pull/15263/files#diff-857189dd46c3a32ffe6a1424eaf41c5fR5
I just followed https://github.com/ros/rosdistro/blob/master/test/rosdep_formatting_test.py and https://github.com/ros/rosdistro/blob/master/scripts/check_rosdep.py style, so please let me know your recommended test and script code, so that I can follow your direction.
parser.add_argument('infiles', nargs='*', help='input rosdep YAML file') | ||
args = parser.parse_args() | ||
if not main(args.infiles): | ||
sys.exit(1) |
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.
This can just be sys.exit(main(...))
then.
test/rosdep_duplicates_test.py
Outdated
|
||
def test(): | ||
files = os.listdir('rosdep') | ||
files = filter(lambda x: x.endswith('.yaml'), files) # accept only file ends with .yaml |
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.
Please use a list comprehension for this instead. Also please follow PEP 8 for the comments (two spaces + #
+ one space + comment text)
test/rosdep_duplicates_test.py
Outdated
files = filter(lambda x: x.endswith('.yaml'), files) # accept only file ends with .yaml | ||
files = [os.path.join('rosdep', x) for x in files] # use relative path | ||
with Fold() as fold: | ||
print("""Running 'scripts/check_duplicates.py' on all '*.yaml' in the 'rosdep' directory. |
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.
Please use single "
here. No need to use """
.
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.
@dirk-thomas thank you for comment, I think I have fixed all parts
scripts/check_duplicates.py
Outdated
rosdep_data = yaml.load(f.read()) | ||
# osx-homebrow uses xos tag | ||
tag = 'osx' if 'osx-' in filepath else '' | ||
model = CachedDataSource('yaml', 'flie:/'+filepath, [tag], rosdep_data) |
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.
Spelling: flie
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.
CI is currently failing.
…error code or 0 if successful." This reverts commit 97c33af.
@dirk-thomas thank you!! |
Thank you for your effort coming up with the patch! |
as suggested at ros-infrastructure/rosdep#520 (review)
added argumetns to allow take local files
I also added this to test, but I'm afraid this is too aggresive
@tfoote