This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Increased test coverage of test_glob.py
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.4
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: eng793, ezio.melotti, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2012-08-31 02:52 by eng793, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
glob-cov-incr.patch eng793, 2012-08-31 02:52 patch to test_glob.py review
test_glob.patch eng793, 2012-08-31 21:35 patch to test_glob.py review
test_glob.patch eng793, 2012-09-01 09:31 patch to test_glob.py review
test_glob.patch.updated r.david.murray, 2012-09-01 19:24 review
issue15826.diff ezio.melotti, 2013-10-14 02:05 review
Messages (10)
msg169496 - (view) Author: Alessandro Moura (eng793) * Date: 2012-08-31 02:52
Hi,

Here is a patch to increase test coverage of test_glob.py. I added tests where the glob patterns are of type bytes. The coverage (according to coverage.py) is now complete, except for what are clearly artefacts probably caused by the fact that glob is loaded before coverage measurements start (global statements are reported not covered but local ones are).
msg169554 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-08-31 16:25
I think it would be easier to subclass GlobTests and override norm and glob there (assuming that doesn't create problems with some of the tests).
msg169586 - (view) Author: Alessandro Moura (eng793) * Date: 2012-08-31 21:35
Agreed, here is the patch where this is done.
msg169602 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-09-01 01:39
Is test_bytes_glob_directory_with_trailing_slash unique to bytes, or should it be added to the base class instead?

What would be useful as bytes-only tests, I think, would be tests of non-ascii stuff.

Although that makes me wonder, do we test non-ascii unicode in the string tests?  I presume that ought to be tested, too, though I suppose that could be tricky if the default encoding of the system the tests are running on can't handle the selected characters (such as, if it is ASCII).

Both of those are extras, though, the main question before committing this patch is the first one.
msg169617 - (view) Author: Alessandro Moura (eng793) * Date: 2012-09-01 09:31
test_bytes_glob_directory_with_trailing_slash already has a counterpart in the main class, but it is not easily handled by overriding self.glob and self.norm. Since it is only a single test, I just decided to override test_glob_directory_with_trailing_slash from the main class. But looking at this now I realize that I actually created another method with a different name by mistake; so the attached patch changes that.
msg169668 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-09-01 19:24
I've modified your patch slightly (cosmetic only).

When I run it on default I get the following:

/home/rdmurray/python/p33/Lib/os.py:263: BytesWarning: Comparison between bytes and string
  if tail == curdir:           # xxx/newdir/. exists if xxx/newdir exists
/home/rdmurray/python/p33/Lib/glob.py:63: BytesWarning: Comparison between bytes and string
  if basename == '':


These presumably represent bugs.  Care to investigate and file issues for them?
msg169675 - (view) Author: Alessandro Moura (eng793) * Date: 2012-09-01 22:36
Im OK with the patch changes.

'''
/home/rdmurray/python/p33/Lib/os.py:263: BytesWarning: Comparison between bytes and string
  if tail == curdir:           # xxx/newdir/. exists if xxx/newdir exists
/home/rdmurray/python/p33/Lib/glob.py:63: BytesWarning: Comparison between bytes and string
  if basename == '':
'''

Yes, I do see these warnings running with -b. I will look into them and try to fix them.
msg170869 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-09-21 09:07
FTR this is addressed in #15845.
msg224584 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-02 19:41
GlobTests.glob() tests that glob() for bytes returns the same (encoded) result as glob() for string. Therefore this patch is not needed, it doesn't increase test coverage.
msg224718 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-08-04 13:54
OK, I'll close the issue then.
Alessandro, thanks anyway for the patch!
History
Date User Action Args
2022-04-11 14:57:35adminsetgithub: 60030
2014-08-04 13:54:50ezio.melottisetstatus: open -> closed
resolution: out of date
messages: + msg224718

stage: commit review -> resolved
2014-08-02 19:41:47serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg224584
2013-12-22 21:06:19pitrousetassignee: ezio.melotti
2013-10-14 02:05:10ezio.melottisetfiles: + issue15826.diff
stage: patch review -> commit review
versions: - Python 3.2, Python 3.3
2012-09-21 09:07:22ezio.melottisetmessages: + msg170869
2012-09-01 22:36:13eng793setmessages: + msg169675
2012-09-01 19:24:38r.david.murraysetfiles: + test_glob.patch.updated

messages: + msg169668
2012-09-01 09:31:59eng793setfiles: + test_glob.patch

messages: + msg169617
2012-09-01 01:39:11r.david.murraysetnosy: + r.david.murray
messages: + msg169602
2012-08-31 21:35:08eng793setfiles: + test_glob.patch

messages: + msg169586
2012-08-31 16:25:58ezio.melottisetversions: + Python 3.2, Python 3.4
nosy: + ezio.melotti

messages: + msg169554

stage: patch review
2012-08-31 02:52:14eng793create