CEXT-Dan / PyRx

Python for AutoCAD
42 stars 7 forks source link

Unit test error BCAD V24, Python 3.12.2 #7

Closed schoeller closed 5 months ago

schoeller commented 6 months ago

Dear all,

thanks again for this open source. when running pytestall under BCAD V24 I received the following error:

TestGe
======================================================================
ERROR: test_scale2_postMultBy (UnitTestPyAcGe.TestGe.test_scale2_postMultBy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\temp/pyrxgit/pyrx-main/unit tests\UnitTestPyAcGe.py", line 39, in test_scale2_postMultBy
    scaleL.postMultBy(scaleR)
    ^^^^^^^^^^^^^^^^^
AttributeError: 'Scale2d' object has no attribute 'postMultBy'

======================================================================
ERROR: test_scale2_preMultBy (UnitTestPyAcGe.TestGe.test_scale2_preMultBy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\temp/pyrxgit/pyrx-main/unit tests\UnitTestPyAcGe.py", line 32, in test_scale2_preMultBy
    scaleL.preMultBy(scaleR)
    ^^^^^^^^^^^^^^^^
AttributeError: 'Scale2d' object has no attribute 'preMultBy'

======================================================================
ERROR: test_scale2_setToProduct1 (UnitTestPyAcGe.TestGe.test_scale2_setToProduct1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\temp/pyrxgit/pyrx-main/unit tests\UnitTestPyAcGe.py", line 46, in test_scale2_setToProduct1
    scale1.setToProduct(scale2,2)
    ^^^^^^^^^^^^^^^^^^^
AttributeError: 'Scale2d' object has no attribute 'setToProduct'

======================================================================
ERROR: test_surfSurfInt (UnitTestPyAcGe.TestGe.test_surfSurfInt)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\temp/pyrxgit/pyrx-main/unit tests\UnitTestPyAcGe.py", line 306, in test_surfSurfInt
    si = PyGe.SurfSurfInt(p1,p3)
         ^^^^^^^^^^^^^^^^
AttributeError: module 'PyGe' has no attribute 'SurfSurfInt'

----------------------------------------------------------------------
Ran 37 tests in 0.008s

FAILED (errors=4)

<unittest.runner.TextTestResult run=37 errors=4 failures=0>
pyrxobject
----------------------------------------------------------------------
Ran 5 tests in 0.001s

OK

<unittest.runner.TextTestResult run=5 errors=0 failures=0>

Ersetzen der Schriftart "archquik.shx" durch die Schriftart "simplex.shx"

  (Schriftart Pfad: "C:\Program Files\Bricsys\BricsCAD V24 de_DE\Fonts\simplex.shx")
TestDatabase
======================================================================
FAIL: test_tdusrtimer (UnitTestPyDatabase.TestDatabase.test_tdusrtimer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\temp/pyrxgit/pyrx-main/unit tests\UnitTestPyDatabase.py", line 262, in test_tdusrtimer
    self.assertEqual(date2.second() - date1.second() ,1)
AssertionError: 0 != 1

----------------------------------------------------------------------
Ran 21 tests in 1.529s

FAILED (failures=1)

<unittest.runner.TextTestResult run=21 errors=0 failures=1>
pydbobject
----------------------------------------------------------------------
Ran 3 tests in 0.002s

OK

<unittest.runner.TextTestResult run=3 errors=0 failures=0>
TestDbObjectId
----------------------------------------------------------------------
Ran 2 tests in 0.000s

OK

<unittest.runner.TextTestResult run=2 errors=0 failures=0>
TestDbPoint
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK

<unittest.runner.TextTestResult run=1 errors=0 failures=0>
TestDbEval
----------------------------------------------------------------------
Ran 2 tests in 0.001s

OK

<unittest.runner.TextTestResult run=2 errors=0 failures=0>
TestDbPoint
======================================================================
ERROR: test_dbcircle (UnitTestPyDbEntity.TestDbEntity.test_dbcircle)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\temp/pyrxgit/pyrx-main/unit tests\UnitTestPyDbEntity.py", line 116, in test_dbcircle
    self.assertEqual(circle.diameter(), 40)
                     ^^^^^^^^^^^^^^^^^
RuntimeError: 
Exception, Not implemented in BRX!, function diameter ,Line 2741, File PyDbEnts.cpp: 

----------------------------------------------------------------------
Ran 23 tests in 0.609s

FAILED (errors=1)

<unittest.runner.TextTestResult run=23 errors=1 failures=0>

I am running Python 3.12.2 and PyRx version <1.1.161.20240226>. Please advise as of how to assist further.

Best regards

Sebastian

CEXT-Dan commented 6 months ago

Hi, thanks for the report. This is an interesting case because I am aware of these failures, but I’m not sure how to deal with them.

The short version: These are classes and functions missing in BricsCAD, or BricsCAD has different behavior than AutoCAD

Long version: I use the ObjectARX SDK to create the wrappers and tests. Then I compile for other platforms such as BricsCAD. If I run into a compiler error, then I throw an exception. I.e. Exception, Not implemented in BRX!, function diameter ,Line 2741, File PyDbEnts.cpp:

https://github.com/CEXT-Dan/PyRx/blob/e8af5e7fc4dc53db2100ae311b212873f4b4ec2f/PyRx/PyDbEnts.cpp#L2720-L2754

I report serious bugs to Bricsys, but not for features that are not commonly used. If there’s a feature that you need, create an issue here and I will create a support ticket on your behalf or ask that you be included in the conversation.

I only want to generate one interfaces, one set of .pyi files. I don’t want to hide failing tests, so I will add I’ll add something like “This is a known failure”.

CEXT-Dan commented 6 months ago

@Canary818 would it be possible for you to add a message to known failing tests? something like "Known failure in {}" or maybe there's already a way to do this in the test suite.

you can get the running app from function

 host = Ap.Application.hostAPI() #make this a global?
        ....
        if host == "BRX24":
            "known ..."
        ....
schoeller commented 5 months ago

Would this be an option?

....
host = PyAp.Application.hostAPI()
....
    @unittest.skipIf(host == "BRX24", "Skipping test due to BricsCAD behaviour on 'preMultBy'")
    def test_scale2_preMultBy(self):
CEXT-Dan commented 5 months ago

Thanks for the tip!

I was toying with this by putting skip in the body, I like your attribute better I had asked Canary818 to wait on this because I’m reluctant to ‘hide’ test failures, I want people to know that somethings just don’t work on some platforms. But on the other hand, if a change is made that causes a new test failure, it will most certainly get lost in the noise.

At some point, the test system should be expanded, maybe write to a log as well so it can be parsed by a log viewer. But for now , @unittest.skipIf works