feature request: configure __name__

Bug #326620 reported by qmax
2
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Wishlist
Andreas Roehler

Bug Description

While evaluating buffer, it may be not appropriative to run tests or whatever is intended to do when __name__ == __main__
It would be convenient to have an option to change value of the __name__

Changed in python-mode:
assignee: nobody → Andreas Roehler (a-roehler)
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Hi,

__name__ is set by python itself.

Don't consider it an python-mode task to interfere with python's internals.

OTOH might consider your request as for an python-test-mode, which does an import, not sure.

Andreas

Changed in python-mode:
status: New → Confirmed
Changed in python-mode:
milestone: none → 6.0
milestone: 6.0 → none
milestone: none → 6.1
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Hi,

AFAIU running tests by default is one of the purposes that python-feature.
Don't think we should circumvent it from the Emacs Lisp side, which would lead into confusion and trouble.

Are several ways not to run tests:

- don't evaluate the section tests are called
- don't bind tests that way, rather make them called expressingly

Setting that report at `opinion', a way closing it.

Thanks taking part anyway,

Andreas

Changed in python-mode:
status: Confirmed → Opinion
Changed in python-mode:
status: Opinion → New
importance: Undecided → Medium
Changed in python-mode:
importance: Medium → Wishlist
Changed in python-mode:
milestone: 6.1.1 → 6.1.2
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Will provide an option. When `t', code inside this block is not executed by C-c C-c

Changed in python-mode:
status: New → In Progress
Revision history for this message
Andreas Roehler (a-roehler) wrote :

Setting `py-if-name-main-permission-p' to nil should suppress execution of code inside blocks started by

if __name__== '__main__'

Changed in python-mode:
status: In Progress → Fix Committed
Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.