ansible/docs/docsite/rst/dev_guide/testing/sanity/no-main-display.rst
Matt Martz 9773a1f289
Add a Singleton metaclass, use it with Display (#48935)
* Add a Singleton class, use it with Display

* update six import

* Move remaining failes to display singleton

* Fix rebase issues

* Singleton improvements

* Add code-smell for 'from __main__ import display'. ci_complete

* s/self/cls/g

* Add docs for no-main-display

* Address linting issues

* Add changelog fragment. ci_complete

* Implement reentrant lock for class instantiation in Singleton

* Add Display singleton porting guide
2018-11-20 17:06:51 -06:00

12 lines
390 B
ReStructuredText

Sanity Tests » no-main-display
==============================
As of Ansible 2.8, ``Display`` should no longer be imported from ``__main__``.
``Display`` is now a singleton and should be utilized like the following::
from ansible.utils.display import Display
display = Display()
There is no longer a need to attempt ``from __main__ import display`` inside
a ``try/except`` block.