| 1 | #!/usr/bin/python3 |
| 2 | """ |
| 3 | Autopkgtest for flowblade package. |
| 4 | Tests basic import functionality and numpy integration. |
| 5 | """ |
| 6 | |
| 7 | import sys |
| 8 | |
| 9 | def test_basic_imports(): |
| 10 | """Test that flowblade modules can be imported.""" |
| 11 | print("Testing basic flowblade imports...") |
| 12 | |
| 13 | try: |
| 14 | # Test numpy import (the main dependency we're testing) |
| 15 | import numpy |
| 16 | print("✓ numpy imported successfully") |
| 17 | |
| 18 | # Test other critical dependencies |
| 19 | import cairo |
| 20 | print("✓ cairo imported successfully") |
| 21 | |
| 22 | import PIL |
| 23 | print("✓ PIL imported successfully") |
| 24 | |
| 25 | import cv2 |
| 26 | print("✓ opencv (cv2) imported successfully") |
| 27 | |
| 28 | # Test that numpy works with basic operations |
| 29 | arr = numpy.array([1, 2, 3, 4, 5]) |
| 30 | assert arr.sum() == 15, "numpy array operations failed" |
| 31 | print("✓ numpy array operations work correctly") |
| 32 | |
| 33 | # Test numpy dtype functionality |
| 34 | arr_float = numpy.array([1.0, 2.0, 3.0], dtype=numpy.float64) |
| 35 | assert arr_float.dtype == numpy.float64, "numpy dtype handling failed" |
| 36 | print("✓ numpy dtype handling works correctly") |
| 37 | |
| 38 | print("\nAll import tests passed successfully!") |
| 39 | return 0 |
| 40 | |
| 41 | except ImportError as e: |
| 42 | print(f"✗ Import failed: {e}", file=sys.stderr) |
| 43 | return 1 |
| 44 | except AssertionError as e: |
| 45 | print(f"✗ Test assertion failed: {e}", file=sys.stderr) |
| 46 | return 1 |
| 47 | except Exception as e: |
| 48 | print(f"✗ Unexpected error: {e}", file=sys.stderr) |
| 49 | return 1 |
| 50 | |
| 51 | if __name__ == "__main__": |
| 52 | sys.exit(test_basic_imports()) |