Skip to content

Commit 1385650

Browse files
committed
Remove Unix-only features from tests
- This makes them work on Windows too.
1 parent 9288f21 commit 1385650

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/test.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ def testSegmentPlaneObject(self):
119119

120120

121121
def test_pcd_read():
122-
TMPL = """
123-
# .PCD v.7 - Point Cloud Data file format
122+
TMPL = """# .PCD v.7 - Point Cloud Data file format
124123
VERSION .7
125124
FIELDS x y z
126125
SIZE 4 4 4
@@ -135,10 +134,11 @@ def test_pcd_read():
135134

136135
a = np.array(np.mat(SEGDATA, dtype=np.float32))
137136
npts = a.shape[0]
138-
with open("/tmp/test.pcd", "w") as f:
137+
tmp_file = tempfile.mkstemp(suffix='.pcd')[1]
138+
with open(tmp_file, "w") as f:
139139
f.write(TMPL % {"npts": npts, "data": SEGDATA.replace(";", "")})
140140

141-
p = pcl.load("/tmp/test.pcd")
141+
p = pcl.load(tmp_file)
142142

143143
assert p.width == npts
144144
assert p.height == 1
@@ -169,7 +169,7 @@ def test_copy():
169169
class TestSegmentCylinder(unittest.TestCase):
170170

171171
def setUp(self):
172-
self.p = pcl.load("tests/table_scene_mug_stereo_textured_noplane.pcd")
172+
self.p = pcl.load("tests" + os.path.sep + "table_scene_mug_stereo_textured_noplane.pcd")
173173

174174
def testSegment(self):
175175
seg = self.p.make_segmenter_normals(50)
@@ -194,7 +194,7 @@ def testSegment(self):
194194
class TestSave(unittest.TestCase):
195195

196196
def setUp(self):
197-
self.p = pcl.load("tests/table_scene_mug_stereo_textured_noplane.pcd")
197+
self.p = pcl.load("tests" + os.path.sep + "table_scene_mug_stereo_textured_noplane.pcd")
198198
self.tmpdir = tempfile.mkdtemp(suffix='pcl-test')
199199

200200
def tearDown(self):
@@ -211,7 +211,7 @@ def testSave(self):
211211
class TestFilter(unittest.TestCase):
212212

213213
def setUp(self):
214-
self.p = pcl.load("tests/flydracyl.pcd")
214+
self.p = pcl.load("tests" + os.path.sep + "flydracyl.pcd")
215215

216216
def testFilter(self):
217217
mls = self.p.make_moving_least_squares()
@@ -228,7 +228,7 @@ def testFilter(self):
228228
class TestExtract(unittest.TestCase):
229229

230230
def setUp(self):
231-
self.p = pcl.load("tests/flydracyl.pcd")
231+
self.p = pcl.load("tests" + os.path.sep + "flydracyl.pcd")
232232

233233
def testExtractPos(self):
234234
p2 = self.p.extract([1, 2, 3], False)
@@ -261,7 +261,7 @@ def testResize(self):
261261
class TestSegmenterNormal(unittest.TestCase):
262262

263263
def setUp(self):
264-
self.p = pcl.load("tests/table_scene_mug_stereo_textured_noplane.pcd")
264+
self.p = pcl.load("tests" + os.path.sep + "table_scene_mug_stereo_textured_noplane.pcd")
265265

266266
def _tpos(self, c):
267267
self.assertEqual(c.size, 22745)
@@ -308,7 +308,7 @@ def testFilterPosNeg(self):
308308
class TestVoxelGridFilter(unittest.TestCase):
309309

310310
def setUp(self):
311-
self.p = pcl.load("tests/table_scene_mug_stereo_textured_noplane.pcd")
311+
self.p = pcl.load("tests" + os.path.sep + "table_scene_mug_stereo_textured_noplane.pcd")
312312

313313
def testFilter(self):
314314
fil = self.p.make_voxel_grid_filter()
@@ -381,7 +381,7 @@ def setUp(self):
381381
self.t = pcl.OctreePointCloud(0.1)
382382

383383
def testLoad(self):
384-
pc = pcl.load("tests/table_scene_mug_stereo_textured_noplane.pcd")
384+
pc = pcl.load("tests" + os.path.sep + "table_scene_mug_stereo_textured_noplane.pcd")
385385
self.t.set_input_cloud(pc)
386386
self.t.define_bounding_box()
387387
self.t.add_points_from_input_cloud()
@@ -402,7 +402,7 @@ class TestOctreePointCloudSearch(unittest.TestCase):
402402

403403
def setUp(self):
404404
self.t = pcl.OctreePointCloudSearch(0.1)
405-
pc = pcl.load("tests/table_scene_mug_stereo_textured_noplane.pcd")
405+
pc = pcl.load("tests" + os.path.sep + "table_scene_mug_stereo_textured_noplane.pcd")
406406
self.t.set_input_cloud(pc)
407407
self.t.define_bounding_box()
408408
self.t.add_points_from_input_cloud()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy