Opened 6 years ago
Closed 6 years ago
#3782 closed defect (fixed)
Python 3: raster/r.in.poly/testsuite/test_rinpoly.py is broken
Reported by: | pmav99 | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Tests | Version: | svn-trunk |
Keywords: | Cc: | ||
CPU: | Unspecified | Platform: | Unspecified |
Description
This is the error:
===================================================================== ERROR: testLabels (__main__.TestRInPoly) Test type of resulting map ---------------------------------------------------------------------- Traceback (most recent call last): File "raster/r.in.poly/testsuite/test_rinpoly.py", line 103, in testLabels self.tmpFile.write(input1) File "/usr/lib/python3.7/tempfile.py", line 481, in func_wrapper return func(*args, **kwargs) TypeError: a bytes-like object is required, not 'str'
The problems is that NamedTemporaryFiles are opened in binary mode by default:
- https://docs.python.org/2/library/tempfile.html#tempfile.NamedTemporaryFile
- https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile
This is the git diff for the fix:
diff --git a/raster/r.in.poly/testsuite/test_rinpoly.py b/raster/r.in.poly/testsuite/test_rinpoly.py index 243dcf9c9..60933bf0c 100644 --- a/raster/r.in.poly/testsuite/test_rinpoly.py +++ b/raster/r.in.poly/testsuite/test_rinpoly.py @@ -6,7 +6,7 @@ from grass.script.core import read_command input1 = \ -""" +b""" A 634308.630394 223320.356473 640640.712946 223092.401501
Should work as it is in Python2 too.
Note:
See TracTickets
for help on using tickets.
In 74309: