Closed RatanShreshtha closed 5 years ago
Merging #42 into master will decrease coverage by
9.52%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #42 +/- ##
==========================================
- Coverage 92.85% 83.33% -9.53%
==========================================
Files 4 4
Lines 168 168
Branches 40 40
==========================================
- Hits 156 140 -16
- Misses 4 14 +10
- Partials 8 14 +6
Impacted Files | Coverage Δ | |
---|---|---|
src/unasync/__init__.py | 83.13% <100%> (-9.64%) |
:arrow_down: |
unasync/__init__.py | 83.13% <0%> (-9.64%) |
:arrow_down: |
Merging #42 into master will not change coverage. The diff coverage is
100%
.
@@ Coverage Diff @@
## master #42 +/- ##
=======================================
Coverage 92.85% 92.85%
=======================================
Files 4 4
Lines 168 168
Branches 40 40
=======================================
Hits 156 156
Misses 4 4
Partials 8 8
Impacted Files | Coverage Δ | |
---|---|---|
src/unasync/__init__.py | 92.77% <100%> (ø) |
:arrow_up: |
I am using tmpdir = str(tmpdir)
in tests which seems to make tests pass, is this a good way to do ?
It feels hacky
It doesn't seems to work on py <= 3.5.
Can you reproduce locally?
(Oh, and it would have been better to separate black and tmpdir into two pull requests.)
For python2, I am getting following error on my local machine
__________________________________________________________________________________ test_unasync[acontext.py] __________________________________________________________________________________
tmpdir = local('/tmp/pytest-of-ratan/pytest-9/test_unasync_acontext_py_0'), source_file = 'acontext.py'
@pytest.mark.parametrize("source_file", TEST_FILES)
def test_unasync(tmpdir, source_file):
unasync.unasync_file(
os.path.join(ASYNC_DIR, source_file), fromdir=ASYNC_DIR, todir=str(tmpdir)
)
encoding = "latin-1" if "encoding" in source_file else "utf-8"
with io.open(os.path.join(SYNC_DIR, source_file), encoding=encoding) as f:
truth = f.read()
> with io.open(tmpdir / source_file, encoding=encoding) as f:
E TypeError: invalid file: local('/tmp/pytest-of-ratan/pytest-9/test_unasync_acontext_py_0/acontext.py')
tests/test_unasync.py:42: TypeError
The issue is that io.open() only accepts a Path object on Python 3.6+. (On Python 3, io.open() is open(), and you can see that information at the bottom of the open() documentation.)
So you need to convert those path to strings before passing them to io.open()
I also run black on the directory so some more files are also in the change list.