[PATCH] D54120: [python] Support PathLike filenames and directories

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 10 00:19:50 PST 2018


mgorny requested changes to this revision.
mgorny added a comment.
This revision now requires changes to proceed.

Also please remember to submit patches with `-U9999`, so that Phab has full context.



================
Comment at: bindings/python/tests/cindex/test_cdb.py:42
 
+    if HAS_FSPATH:
+        def test_lookup_succeed_pathlike(self):
----------------
Please use conditional skipping instead. Maybe write a `@skip_if_no_fspath` decorator in `util.py` and use it for all tests. Skipping will have the advantage that instead of silently pretending we have less tests, we'd explicitly tell user why some of the tests aren't run.


================
Comment at: bindings/python/tests/cindex/util.py:6
+
+try:
+    import pathlib
----------------
Wouldn't it be better to use `if HAS_FSPATH` here? In normal circumstances, the `pathlib` import will be unnecessarily attempted (and it will succeed if `pathlib` package is installed), even though it will never be used inside tests.


Repository:
  rC Clang

https://reviews.llvm.org/D54120





More information about the cfe-commits mailing list