Naggappan Ramukannan
Naggappan Ramukannan

Reputation: 2812

use of @attr in python inside a class

I am going through open-stack Tempest code. I see some syntax @ used inside a class as below. Could some one give me a proper link where i can learn above why this @ is used.

  @classmethod
      def setUpClass(cls):
      cls.set_network_resources()
      super(TestLargeOpsScenario, cls).setUpClass()

or even like this,

  @attr(type='smoke')
  def test_update_setver_name(self):
        name = rand_server('server')

so what is the use of @ over here?

Upvotes: 0

Views: 840

Answers (2)

shambhurajak
shambhurajak

Reputation: 1

@attr , decorator DP. More for good understanding of Decorator DP, examples at: http://thecodeship.com/patterns/guide-to-python-function-decorators/

Upvotes: 0

mjmostachetti
mjmostachetti

Reputation: 716

From the python docs:

Python Doc

Or a previous stackoverflow question:

Previously answered question

Upvotes: 1

Related Questions