Ticket #7867 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

mtd.addOrReplace() is not replacing

Reported by: Arturs Bekasovs Owned by: Martyn Gigg
Priority: blocker Milestone: Release 3.0
Component: Python Keywords:
Cc: nick.draper@… Blocked By:
Blocking: Tester: Arturs Bekasovs

Description (last modified by Arturs Bekasovs) (diff)

mtd.remove("Workspace1")

ws = WorkspaceFactory.create("Workspace2D", 1, 1, 1)
mtd.add("Workspace1", ws)

# Uncommenting the following line elliminates the error
#mtd.remove("Workspace1")

ws2 = WorkspaceFactory.create("Workspace2D", 1, 2, 2)
mtd.addOrReplace("Workspace1", ws2)

I would expect the last line to update "Workspace1" in the ADS to hold ws2, but instead it throws:

RuntimeError:  add : Unable to insert Data Object : 'Workspace1'
  at line 10 in 'New script'

Uncommenting the line solves the problem, which leads to a thought that addOrReplace() is not actually replacing the workspace if it already exists.

Observed in 2.6 on Ubuntu 12.04.

Change History

comment:1 Changed 7 years ago by Arturs Bekasovs

  • Description modified (diff)

comment:2 Changed 7 years ago by Arturs Bekasovs

  • Cc nick.draper@… added

comment:3 Changed 7 years ago by Nick Draper

  • Owner changed from Anyone to Martyn Gigg

comment:4 Changed 7 years ago by Martyn Gigg

  • Status changed from new to inprogress

comment:5 Changed 7 years ago by Martyn Gigg

Fix the export of AnalysisDataService::addOrReplace

Add an explict test for the method. Refs #7867

Changeset: 0b5b0ce38e317824b3d2d945f0f98b7ca58407fd

comment:6 Changed 7 years ago by Martyn Gigg

  • Status changed from inprogress to verify
  • Resolution set to fixed

Branch: bugfix/7867_python_mtd_addorreplace

Tester: The script within the description should now work correctly. The unit test has been extended to cover this case explicitly.

comment:7 Changed 7 years ago by Arturs Bekasovs

  • Status changed from verify to verifying
  • Tester set to Arturs Bekasovs

comment:8 Changed 7 years ago by Arturs Bekasovs

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/bugfix/7867_python_mtd_addorreplace'

Full changeset: e9eac56335f1dc4680c535af2500090384d4ef45

comment:9 Changed 7 years ago by Arturs Bekasovs

Works perfectly now. Unit test seems reasonable.

Last edited 7 years ago by Arturs Bekasovs (previous) (diff)

comment:10 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8712

Note: See TracTickets for help on using tickets.