Skip to content

Commit 8ada2b6

Browse files
Revert "DYN-8274 PythonScript With Dispose when Exception (#16312)" (#16353)
1 parent 00cab14 commit 8ada2b6

3 files changed

Lines changed: 0 additions & 230 deletions

File tree

extern/Python/Python.Runtime.dll

-512 Bytes
Binary file not shown.

test/Libraries/DynamoPythonTests/PythonEditTests.cs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -690,50 +690,6 @@ public void Test_With_Exception_Python()
690690
Assert.IsTrue(pythonNode.NodeInfos.FirstOrDefault().Message.Contains(warningMessageExpected));
691691
}
692692

693-
[Test]
694-
public void Test_With_Exception_IDisposeCheck_Python()
695-
{
696-
//This piece of code will generate an exception in PythonScript node
697-
var line_update = "Point.ByCoordinate(10,20)";
698-
var warningMessageExpected = "type object 'Point' has no attribute 'ByCoordinate'";
699-
700-
// open test graph
701-
var examplePath = Path.Combine(TestDirectory, @"core\python", @"withDisposeFFITarget.dyn");
702-
ViewModel.OpenCommand.Execute(examplePath);
703-
ViewModel.HomeSpace.Run();
704-
705-
var watchNode = ViewModel.Model.CurrentWorkspace.Nodes.OfType<Watch>().First();
706-
var pythonNode = ViewModel.Model.CurrentWorkspace.Nodes.OfType<PythonNode>().First();
707-
708-
//Verify that has the value 1 meaning that was disposed the first time
709-
Assert.That(watchNode.OutputData.InitialValue, Is.EqualTo("1"));
710-
711-
712-
var script = pythonNode.Script;
713-
//Replacing this text in the code will generate an exception in the PythonScript node
714-
script = script.Replace("Point.ByCoordinates(10,20)", line_update);
715-
716-
UpdatePythonNodeContent(pythonNode, script);
717-
pythonNode.OnNodeModified();
718-
ViewModel.HomeSpace.Run();
719-
720-
//Verity that we have 1 warning in the python node
721-
Assert.AreEqual(pythonNode.NodeInfos.Count, 1);
722-
//Check that the warning message expected is correct
723-
Assert.IsTrue(pythonNode.NodeInfos.FirstOrDefault().Message.Contains(warningMessageExpected));
724-
725-
//Restore the string in the script for avoiding the exception when running the graph
726-
script = script.Replace(line_update, "Point.ByCoordinates(10,20)");
727-
UpdatePythonNodeContent(pythonNode, script);
728-
pythonNode.OnNodeModified();
729-
ViewModel.HomeSpace.Run();
730-
731-
//Verity that we don't have warnings in the python node
732-
Assert.AreEqual(pythonNode.NodeInfos.Count, 0);
733-
//Verify Watch node has the value 3 meaning that the object was disposed 3 times (even when there was an exception in the second run)
734-
Assert.That(watchNode.OutputData.InitialValue, Is.EqualTo("3"));
735-
}
736-
737693
[Test]
738694
public void CpythonRestart_ReloadsModules()
739695
{

test/core/python/withDisposeFFITarget.dyn

Lines changed: 0 additions & 186 deletions
This file was deleted.

0 commit comments

Comments
 (0)