Skip to content

Commit

Permalink
[tests] Fixed tests with independend paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigul committed Apr 8, 2024
1 parent 1382bc1 commit 85eddde
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
1 change: 0 additions & 1 deletion requirements-resolver.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-r requirements.txt
probabilistic_model>=4.0.8
random_events>=2.0.9
tqdm
4 changes: 2 additions & 2 deletions src/pycram/datastructures/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from dataclasses import dataclass
from typing_extensions import List, Optional, Tuple, Callable, Dict, Any, Union, TYPE_CHECKING
from .datastructures.enums import JointType, Shape
from .datastructures.pose import Pose, Point
from .enums import JointType, Shape
from .pose import Pose, Point
from abc import ABC, abstractmethod

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/pycram/datastructures/local_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from rospy import Duration

from geometry_msgs.msg import TransformStamped
from .datastructures.pose import Pose, Transform
from .pose import Pose, Transform
from typing_extensions import List, Optional, Union, Iterable


Expand Down
4 changes: 3 additions & 1 deletion test/test_cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
from bullet_world_testcase import BulletWorldTestCase
from pycram.datastructures.enums import ObjectType
from pycram.world_concepts.world_object import Object
import pathlib


class TestCacheManager(BulletWorldTestCase):

def test_generate_description_and_write_to_cache(self):
cache_manager = self.world.cache_manager
path = "../resources/apartment.urdf"
file_path = pathlib.Path(__file__).parent.resolve()
path = str(file_path) + "/../resources/apartment.urdf"
extension = Path(path).suffix
cache_path = self.world.cache_dir + "apartment.urdf"
apartment = Object("apartment", ObjectType.ENVIRONMENT, path)
Expand Down
8 changes: 6 additions & 2 deletions test/test_description.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pathlib

from bullet_world_testcase import BulletWorldTestCase


Expand All @@ -19,9 +21,11 @@ def test_joint_child_link(self):
self.assertEqual(self.robot.get_joint_parent_link("base_footprint_joint"), self.robot.root_link)

def test_generate_description_from_mesh(self):
self.assertTrue(self.milk.description.generate_description_from_file("../resources/cached/milk.stl",
file_path = pathlib.Path(__file__).parent.resolve()
self.assertTrue(self.milk.description.generate_description_from_file(str(file_path) + "/../resources/cached/milk.stl",
"milk", ".stl"))

def test_generate_description_from_description_file(self):
self.assertTrue(self.milk.description.generate_description_from_file("../resources/cached/milk.urdf",
file_path = pathlib.Path(__file__).parent.resolve()
self.assertTrue(self.milk.description.generate_description_from_file(str(file_path) + "/../resources/cached/milk.urdf",
"milk", ".urdf"))
5 changes: 3 additions & 2 deletions test/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pycram.world_concepts.world_object import Object

from geometry_msgs.msg import Point, Quaternion

import pathlib

class TestObject(BulletWorldTestCase):

Expand All @@ -17,7 +17,8 @@ def test_wrong_object_description_path(self):
milk = Object("milk2", ObjectType.MILK, "wrong_path.sk")

def test_malformed_object_description(self):
malformed_file = "../resources/cached/malformed_description.urdf"
file_path = pathlib.Path(__file__).parent.resolve()
malformed_file = str(file_path) + "/../resources/cached/malformed_description.urdf"
with open(malformed_file, "w") as file:
file.write("malformed")
with self.assertRaises(Exception):
Expand Down

0 comments on commit 85eddde

Please sign in to comment.