The Inbox: SUnit-ct.125.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: SUnit-ct.125.mcz

commits-2
Christoph Thiede uploaded a new version of SUnit to project The Inbox:
http://source.squeak.org/inbox/SUnit-ct.125.mcz

==================== Summary ====================

Name: SUnit-ct.125
Author: ct
Time: 29 March 2020, 1:02:50.60056 pm
UUID: 814e778e-04dc-954c-93e3-fb19e307d4c8
Ancestors: SUnit-mt.121

Proposal: Update debugging logic of TestCase. Instead of abusing #halt, open a debugger directly on the test selector. Deprecates #openDebuggerOnFailingTestMethod.

Also slightly refactors internal behavior to avoid some duplication, and to get rid of unnecessary semaphores which should not add any value compared to #ensure: unless some really low-level things are broken. Please correct me if I am wrong here!

=============== Diff against SUnit-mt.121 ===============

Item was added:
+ ----- Method: TestCase>>assureResourcesDuring: (in category 'private') -----
+ assureResourcesDuring: aBlock
+
+ | resources |
+ resources := self resources.
+ resources do: [:resource |
+ resource isAvailable ifFalse: [
+ ^ resource signalInitializationError]].
+ ^ aBlock ensure: [
+ resources do: [:resource |
+ resource reset]].!

Item was changed:
  ----- Method: TestCase>>debug (in category 'running') -----
  debug
+ "Run the receiver and open a debugger on the first failure or error."
+
+ ^ self assureResourcesDuring: [self runCaseWithoutTimeout]!
- self resources do:
- [ : res | res isAvailable ifFalse: [ ^ res signalInitializationError ] ].
- [ self runCase ] ensure:
- [ self resources do:
- [ : each | each reset ] ]!

Item was changed:
  ----- Method: TestCase>>debugAsFailure (in category 'running') -----
  debugAsFailure
+ "Spawn a debugger that is ready to debug the receiver."
+
+ (Process
+ forBlock: [self debug]
+ runUntil: [:context | context selector = testSelector])
+ debug.!
- | semaphore |
- semaphore := Semaphore new.
- self resources do: [:res |
- res isAvailable ifFalse: [^res signalInitializationError]].
- [semaphore wait. self resources do: [:each | each reset]] fork.
- (self class selector: testSelector) runCaseAsFailure: semaphore.!

Item was changed:
  ----- Method: TestCase>>openDebuggerOnFailingTestMethod (in category 'running') -----
  openDebuggerOnFailingTestMethod
+
+ self deprecated: 'ct: Use #debugAsFailure'.
+
  "SUnit has halted one step in front of the failing test method. Step over the 'self halt' and
  send into 'self perform: testSelector' to see the failure from the beginning"
-
  self
  halt;
  performTest!

Item was changed:
  ----- Method: TestCase>>runCaseAsFailure: (in category 'running') -----
  runCaseAsFailure: aSemaphore
+
+ self deprecated: 'ct: Use #runCaseWithoutTimeout and #ensure:'.
+ ^ [self runCaseWithoutTimeout]
+ ensure: [aSemaphore signal]!
- [self setUp.
- self openDebuggerOnFailingTestMethod] ensure: [
- self tearDown.
- aSemaphore signal]!

Item was added:
+ ----- Method: TestCase>>runCaseWithoutTimeout (in category 'running') -----
+ runCaseWithoutTimeout
+
+ [self setUp.
+ self performTest]
+ ensure: [self tearDown].!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: SUnit-ct.125.mcz

marcel.taeumel
Hi all!

Beware of making substantial changes to the public interface of TestCase or the communication between TestCase and TestResult *because* it might interfere with smalltalkCI and its efforts to remain cross-Smalltalk compatible.

So, please double-check. :-)

Best,
Marcel

Am 29.03.2020 14:03:04 schrieb [hidden email] <[hidden email]>:

Christoph Thiede uploaded a new version of SUnit to project The Inbox:
http://source.squeak.org/inbox/SUnit-ct.125.mcz

==================== Summary ====================

Name: SUnit-ct.125
Author: ct
Time: 29 March 2020, 1:02:50.60056 pm
UUID: 814e778e-04dc-954c-93e3-fb19e307d4c8
Ancestors: SUnit-mt.121

Proposal: Update debugging logic of TestCase. Instead of abusing #halt, open a debugger directly on the test selector. Deprecates #openDebuggerOnFailingTestMethod.

Also slightly refactors internal behavior to avoid some duplication, and to get rid of unnecessary semaphores which should not add any value compared to #ensure: unless some really low-level things are broken. Please correct me if I am wrong here!

=============== Diff against SUnit-mt.121 ===============

Item was added:
+ ----- Method: TestCase>>assureResourcesDuring: (in category 'private') -----
+ assureResourcesDuring: aBlock
+
+ | resources |
+ resources := self resources.
+ resources do: [:resource |
+ resource isAvailable ifFalse: [
+ ^ resource signalInitializationError]].
+ ^ aBlock ensure: [
+ resources do: [:resource |
+ resource reset]].!

Item was changed:
----- Method: TestCase>>debug (in category 'running') -----
debug
+ "Run the receiver and open a debugger on the first failure or error."
+
+ ^ self assureResourcesDuring: [self runCaseWithoutTimeout]!
- self resources do:
- [ : res | res isAvailable ifFalse: [ ^ res signalInitializationError ] ].
- [ self runCase ] ensure:
- [ self resources do:
- [ : each | each reset ] ]!

Item was changed:
----- Method: TestCase>>debugAsFailure (in category 'running') -----
debugAsFailure
+ "Spawn a debugger that is ready to debug the receiver."
+
+ (Process
+ forBlock: [self debug]
+ runUntil: [:context | context selector = testSelector])
+ debug.!
- | semaphore |
- semaphore := Semaphore new.
- self resources do: [:res |
- res isAvailable ifFalse: [^res signalInitializationError]].
- [semaphore wait. self resources do: [:each | each reset]] fork.
- (self class selector: testSelector) runCaseAsFailure: semaphore.!

Item was changed:
----- Method: TestCase>>openDebuggerOnFailingTestMethod (in category 'running') -----
openDebuggerOnFailingTestMethod
+
+ self deprecated: 'ct: Use #debugAsFailure'.
+
"SUnit has halted one step in front of the failing test method. Step over the 'self halt' and
send into 'self perform: testSelector' to see the failure from the beginning"
-
self
halt;
performTest!

Item was changed:
----- Method: TestCase>>runCaseAsFailure: (in category 'running') -----
runCaseAsFailure: aSemaphore
+
+ self deprecated: 'ct: Use #runCaseWithoutTimeout and #ensure:'.
+ ^ [self runCaseWithoutTimeout]
+ ensure: [aSemaphore signal]!
- [self setUp.
- self openDebuggerOnFailingTestMethod] ensure: [
- self tearDown.
- aSemaphore signal]!

Item was added:
+ ----- Method: TestCase>>runCaseWithoutTimeout (in category 'running') -----
+ runCaseWithoutTimeout
+
+ [self setUp.
+ self performTest]
+ ensure: [self tearDown].!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: SUnit-ct.125.mcz

Christoph Thiede

Hi Marcel,


yes, I had this in mind! :-)


But smalltalkCI won't do anything that opens a debugger, would it? At least I would not expect this.


And the rest of my changes should not destroy any existing behavior (with the exception of deprecations, which can be fixed later, too). Or do you see any reason where a semaphore does add value?


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 30. März 2020 12:11:55
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] The Inbox: SUnit-ct.125.mcz
 
Hi all!

Beware of making substantial changes to the public interface of TestCase or the communication between TestCase and TestResult *because* it might interfere with smalltalkCI and its efforts to remain cross-Smalltalk compatible.

So, please double-check. :-)

Best,
Marcel

Am 29.03.2020 14:03:04 schrieb [hidden email] <[hidden email]>:

Christoph Thiede uploaded a new version of SUnit to project The Inbox:
http://source.squeak.org/inbox/SUnit-ct.125.mcz

==================== Summary ====================

Name: SUnit-ct.125
Author: ct
Time: 29 March 2020, 1:02:50.60056 pm
UUID: 814e778e-04dc-954c-93e3-fb19e307d4c8
Ancestors: SUnit-mt.121

Proposal: Update debugging logic of TestCase. Instead of abusing #halt, open a debugger directly on the test selector. Deprecates #openDebuggerOnFailingTestMethod.

Also slightly refactors internal behavior to avoid some duplication, and to get rid of unnecessary semaphores which should not add any value compared to #ensure: unless some really low-level things are broken. Please correct me if I am wrong here!

=============== Diff against SUnit-mt.121 ===============

Item was added:
+ ----- Method: TestCase>>assureResourcesDuring: (in category 'private') -----
+ assureResourcesDuring: aBlock
+
+ | resources |
+ resources := self resources.
+ resources do: [:resource |
+ resource isAvailable ifFalse: [
+ ^ resource signalInitializationError]].
+ ^ aBlock ensure: [
+ resources do: [:resource |
+ resource reset]].!

Item was changed:
----- Method: TestCase>>debug (in category 'running') -----
debug
+ "Run the receiver and open a debugger on the first failure or error."
+
+ ^ self assureResourcesDuring: [self runCaseWithoutTimeout]!
- self resources do:
- [ : res | res isAvailable ifFalse: [ ^ res signalInitializationError ] ].
- [ self runCase ] ensure:
- [ self resources do:
- [ : each | each reset ] ]!

Item was changed:
----- Method: TestCase>>debugAsFailure (in category 'running') -----
debugAsFailure
+ "Spawn a debugger that is ready to debug the receiver."
+
+ (Process
+ forBlock: [self debug]
+ runUntil: [:context | context selector = testSelector])
+ debug.!
- | semaphore |
- semaphore := Semaphore new.
- self resources do: [:res |
- res isAvailable ifFalse: [^res signalInitializationError]].
- [semaphore wait. self resources do: [:each | each reset]] fork.
- (self class selector: testSelector) runCaseAsFailure: semaphore.!

Item was changed:
----- Method: TestCase>>openDebuggerOnFailingTestMethod (in category 'running') -----
openDebuggerOnFailingTestMethod
+
+ self deprecated: 'ct: Use #debugAsFailure'.
+
"SUnit has halted one step in front of the failing test method. Step over the 'self halt' and
send into 'self perform: testSelector' to see the failure from the beginning"
-
self
halt;
performTest!

Item was changed:
----- Method: TestCase>>runCaseAsFailure: (in category 'running') -----
runCaseAsFailure: aSemaphore
+
+ self deprecated: 'ct: Use #runCaseWithoutTimeout and #ensure:'.
+ ^ [self runCaseWithoutTimeout]
+ ensure: [aSemaphore signal]!
- [self setUp.
- self openDebuggerOnFailingTestMethod] ensure: [
- self tearDown.
- aSemaphore signal]!

Item was added:
+ ----- Method: TestCase>>runCaseWithoutTimeout (in category 'running') -----
+ runCaseWithoutTimeout
+
+ [self setUp.
+ self performTest]
+ ensure: [self tearDown].!




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: SUnit-ct.125.mcz

marcel.taeumel
Hi Christoph,

I think that this contribution is compatible with smalltalkCI. Yes. :-)

Best,
Marcel

Am 30.03.2020 15:14:14 schrieb Thiede, Christoph <[hidden email]>:

Hi Marcel,


yes, I had this in mind! :-)


But smalltalkCI won't do anything that opens a debugger, would it? At least I would not expect this.


And the rest of my changes should not destroy any existing behavior (with the exception of deprecations, which can be fixed later, too). Or do you see any reason where a semaphore does add value?


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 30. März 2020 12:11:55
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] The Inbox: SUnit-ct.125.mcz
 
Hi all!

Beware of making substantial changes to the public interface of TestCase or the communication between TestCase and TestResult *because* it might interfere with smalltalkCI and its efforts to remain cross-Smalltalk compatible.

So, please double-check. :-)

Best,
Marcel

Am 29.03.2020 14:03:04 schrieb [hidden email] <[hidden email]>:

Christoph Thiede uploaded a new version of SUnit to project The Inbox:
http://source.squeak.org/inbox/SUnit-ct.125.mcz

==================== Summary ====================

Name: SUnit-ct.125
Author: ct
Time: 29 March 2020, 1:02:50.60056 pm
UUID: 814e778e-04dc-954c-93e3-fb19e307d4c8
Ancestors: SUnit-mt.121

Proposal: Update debugging logic of TestCase. Instead of abusing #halt, open a debugger directly on the test selector. Deprecates #openDebuggerOnFailingTestMethod.

Also slightly refactors internal behavior to avoid some duplication, and to get rid of unnecessary semaphores which should not add any value compared to #ensure: unless some really low-level things are broken. Please correct me if I am wrong here!

=============== Diff against SUnit-mt.121 ===============

Item was added:
+ ----- Method: TestCase>>assureResourcesDuring: (in category 'private') -----
+ assureResourcesDuring: aBlock
+
+ | resources |
+ resources := self resources.
+ resources do: [:resource |
+ resource isAvailable ifFalse: [
+ ^ resource signalInitializationError]].
+ ^ aBlock ensure: [
+ resources do: [:resource |
+ resource reset]].!

Item was changed:
----- Method: TestCase>>debug (in category 'running') -----
debug
+ "Run the receiver and open a debugger on the first failure or error."
+
+ ^ self assureResourcesDuring: [self runCaseWithoutTimeout]!
- self resources do:
- [ : res | res isAvailable ifFalse: [ ^ res signalInitializationError ] ].
- [ self runCase ] ensure:
- [ self resources do:
- [ : each | each reset ] ]!

Item was changed:
----- Method: TestCase>>debugAsFailure (in category 'running') -----
debugAsFailure
+ "Spawn a debugger that is ready to debug the receiver."
+
+ (Process
+ forBlock: [self debug]
+ runUntil: [:context | context selector = testSelector])
+ debug.!
- | semaphore |
- semaphore := Semaphore new.
- self resources do: [:res |
- res isAvailable ifFalse: [^res signalInitializationError]].
- [semaphore wait. self resources do: [:each | each reset]] fork.
- (self class selector: testSelector) runCaseAsFailure: semaphore.!

Item was changed:
----- Method: TestCase>>openDebuggerOnFailingTestMethod (in category 'running') -----
openDebuggerOnFailingTestMethod
+
+ self deprecated: 'ct: Use #debugAsFailure'.
+
"SUnit has halted one step in front of the failing test method. Step over the 'self halt' and
send into 'self perform: testSelector' to see the failure from the beginning"
-
self
halt;
performTest!

Item was changed:
----- Method: TestCase>>runCaseAsFailure: (in category 'running') -----
runCaseAsFailure: aSemaphore
+
+ self deprecated: 'ct: Use #runCaseWithoutTimeout and #ensure:'.
+ ^ [self runCaseWithoutTimeout]
+ ensure: [aSemaphore signal]!
- [self setUp.
- self openDebuggerOnFailingTestMethod] ensure: [
- self tearDown.
- aSemaphore signal]!

Item was added:
+ ----- Method: TestCase>>runCaseWithoutTimeout (in category 'running') -----
+ runCaseWithoutTimeout
+
+ [self setUp.
+ self performTest]
+ ensure: [self tearDown].!