Skip to content
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

when run on a directory the tappy cli tool expects all files in a directory to be tap files and will fail otherwise #114

Open
cj-timothy-sampson opened this issue Jun 22, 2021 · 2 comments

Comments

@cj-timothy-sampson
Copy link

This makes it more painful to use than needs be in the case where one has a single "reports" dir that contains files of many types (junit xml files, tap files and whatever else)

$ tappy .
......
----------------------------------------------------------------------
Ran 6 tests in 0.000s

OK
$ cat *
1..3
ok 1 - Input file opened
ok 2 - First line of the input valid
ok 3 - Read the rest of the file
1..3
ok 1 - Input file opened
ok 2 - First line of the input valid
ok 3 - Read the rest of the file
$ ll
total 136
drwxrwxr-x  2 tsampson tsampson   4096 Jun 22 10:59 .
-rw-rw-r--  1 tsampson tsampson    100 Jun 22 10:59 2.tap
-rw-rw-r--  1 tsampson tsampson    100 Jun 22 11:02 1.tap
drwxrwxrwt 36 root     root     122880 Jun 22 11:09 ..
$ touch random.junit.xml
$ tappy .
......F
======================================================================
FAIL: <file=./random.junit.xml>
Missing a plan.
----------------------------------------------------------------------

----------------------------------------------------------------------
Ran 7 tests in 0.000s

FAILED (failures=1)

Arguably tappy shouldn't be trying to parse an xml file as a tap file. One could argue that the user should filter non-tap-files out but this makes calling tappy with a dir less useful than it might otherwise be.

@cj-timothy-sampson
Copy link
Author

Seems like this might be rather simple to fix by just globbing over *.tap here:

def _find_tests_in_directory(self, directory, suite):
?

@mblayman
Copy link
Member

Thanks for the report, @timsampsoncujo! This is an interesting case that I'm not sure how to handle.

I try my best to implement this library according to the TAP spec. There is nothing in the spec that says that a TAP file ends with .tap (there is also no MIME type on the official Media Types list). I think it would be an overreach to filter on files that look for that filename pattern.

The workaround solution would be to run:

$ tappy *.tap

I think a likely solution would be to opt out of the parsing errors as described in issue #39.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants