Ticket #7419 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Add warning message when using old Python API

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: blocker Milestone: Release 2.6
Component: Python Keywords:
Cc: Blocked By:
Blocking: Tester: Andrei Savici

Description

We need to start warning people that the old Python API will disappear in 2.7. This should happen on MantidPlot startup and also whenever anyone runs an algorithm through the old mantidsimple methods.

Attachments

test_depr.py (352 bytes) - added by Martyn Gigg 7 years ago.

Change History

comment:1 Changed 7 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:2 Changed 7 years ago by Martyn Gigg

  • Summary changed from Add deprecation message for old Python api to Add warning message when using old Python API

comment:3 Changed 7 years ago by Martyn Gigg

Add warning message about removing old API.

You can also suppress the warnings on a per-file basis. Refs #7419

Changeset: 5931f84531807cd2a554ba760cd7a1da347bbe1f

comment:4 Changed 7 years ago by Martyn Gigg

Merge branch 'feature/7419_old_python_api_warning' into develop

Refs #7419 Conflicts:

Code/Mantid/scripts/reduction_workflow/instruments/sans/hfir_command_interface.py

Changeset: 7d7760f3148c5ba68384d25a64a007376a9ddeed

comment:5 Changed 7 years ago by Martyn Gigg

Branch: feature/7419_old_python_api_warning

Tester: After merging, starting MantidPlot should give a message about the old API being removed in version 2.7. In addition, whenever you run an algorithm through the old mantidsimple functions you will get a message about using a feature that is going to disappear. It will print the line number & src file you are running from a saved file

  • Check that running an algorithm out of the box in MantidPlot from Python doesn't produce any warnings. You can use the attached script and comment/uncomment the 'from mantidsimple import *' line

Also then check that the suppressV1Warnings function works correctly. It takes two arguments: filename & True/False for whether warnings are suppressed or not. The default is true so just the filename can be provided. The suppression is persistent across the MantidPlot session and you have to actively not suppress them (i.e. flick value to False) to get the warnings back.

Changed 7 years ago by Martyn Gigg

comment:6 Changed 7 years ago by Martyn Gigg

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

comment:7 Changed 7 years ago by Andrei Savici

  • Status changed from verify to verifying
  • Tester set to Andrei Savici

comment:8 Changed 7 years ago by Andrei Savici

  • Status changed from verifying to closed

Works as described

comment:9 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8265

Note: See TracTickets for help on using tickets.