pharo-spec / Spec

Spec is a framework in Pharo for describing user interfaces.
MIT License
61 stars 63 forks source link

Defer tests to the morphic ui thread #1496

Closed guillep closed 9 months ago

guillep commented 9 months ago

Make Spec tests run in the UI thread to avoid concurrency issues.

The problem is more detailed in here: https://github.com/pharo-project/pharo/issues/12502

Problem summary: during the test run in the CI, tests and morphic run in separate tests. Thus, a test might change a graphic element during the morphic ui draw and break it. If an exception happens in a thread other than the test thread, the process quits and stops the test run with an unexpected outcome.

guillep commented 9 months ago

There is a broken test, unrelated, and caused by some protocol recompilation.

To see the issue in isolation of this PR, the following code adds a new superclass and breaks the test:

ProperPackagesTest debug: #testPackageExtensionsStartsWithProperPackageName.

newTestCase := (TestCase << #NewTestCase)
    package: #toto;
    install.

(newTestCase << #SpBaseTest)
    install.

ProperPackagesTest debug: #testPackageExtensionsStartsWithProperPackageName.