Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fix local tests

edgarriba2f1d583c63ec
diff --git a/.gitignore b/.gitignore
index af4efcdde..12d3b0e59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,7 @@ torchgeometry.egg-info/
*/**/*~
*~
*.swp
+.eggs/*
+.cache/*
+.pytest_cache/*
docs/build
diff --git a/README.rst b/README.rst
index 715e6b1bd..3d3ae3e93 100644
--- a/README.rst
+++ b/README.rst
@@ -12,6 +12,12 @@ From source:
python setup.py install
+Testing
+=======
+
+.. code:: bash
+
+ python setup.py test
Contributing
============
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 000000000..b7e478982
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,2 @@
+[aliases]
+test=pytest
diff --git a/setup.py b/setup.py
index b2b4749f6..bb1c13943 100644
--- a/setup.py
+++ b/setup.py
@@ -43,6 +43,10 @@ setup(
long_description=readme,
license='BSD',
+ # Test
+ setup_requires=['pytest-runner'],
+ tests_require=['pytest'],
+
# Package info
packages=find_packages(exclude=('test',)),
diff --git a/test/test_functional.py b/test/test_functional.py
index 30892ebaf..a49f748c5 100644
--- a/test/test_functional.py
+++ b/test/test_functional.py
@@ -10,15 +10,16 @@ class Tester(unittest.TestCase):
points = torch.rand(1, 2, 3)
points_h = dgm.convert_points_to_homogeneous(points)
- assert (points_h[..., -1] == torch.ones(1, 2, 1)).all()
+ self.assertTrue((points_h[..., -1] == torch.ones(1, 2, 1)).all())
def test_convert_points_from_homogeneous(self):
points_h = torch.rand(1, 2, 3)
points_h[..., -1] = 1.0
points = dgm.convert_points_from_homogeneous(points_h)
- assert (points_h[..., :2] == points[..., :2]).all()
+ error = torch.sum((points_h[..., :2] - points) ** 2)
+ self.assertAlmostEqual(error, 0.0)
if __name__ == '__main__':
unittest.main()