test.py
Go to the documentation of this file.
1 import resource_retriever as r
2 
3 import os
4 import rospkg
5 from nose.tools import raises
6 
7 rospack = rospkg.RosPack()
8 
10  res = r.get("package://resource_retriever/test/test.txt")
11  assert len(res) == 1
12  assert res == 'A'.encode()
13 
15  res_path = os.path.join(rospack.get_path("resource_retriever"), "test/large_filepy.dat")
16  with open(res_path, 'w') as f:
17  for _ in range(1024*1024*50):
18  f.write('A')
19  res = r.get("package://resource_retriever/test/large_filepy.dat")
20  assert len(res) == 1024*1024*50
21 
22 def test_http():
23  res = r.get("http://packages.ros.org/ros.key")
24  assert len(res) > 0
25 
26 @raises(Exception)
28  r.get("file://fail")
29 
30 @raises(Exception)
32  r.get("package://roscpp")
33 
34 @raises(rospkg.common.ResourceNotFound)
36  r.get("package://invalid_package_blah/test.xml")
def test_invalid_package()
Definition: test.py:35
def test_get_by_package()
Definition: test.py:9
def test_http()
Definition: test.py:22
def test_invalid_file()
Definition: test.py:27
def test_no_file()
Definition: test.py:31
def test_get_large_file()
Definition: test.py:14


resource_retriever
Author(s): Josh Faust , Ioan Sucan
autogenerated on Mon Feb 17 2020 03:17:24