title: Robot Framework custom keyword only in Test Setup
body: <p>Is there a possibility in Robot Framework to <strong>allow executing a custom keyword only in Test Setup</strong> part (or alternatively in Test Teardown)? Assuming that I have a keyword called <code>My Setup</code>. If <code>My Setup</code> is executed in a normal step (i.e. not in Test Setup), the test should fail. RF Documentation about <a href="http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#creating-user-keywords" rel="nofollow noreferrer">User keywords</a> and browsing through StackOverflow didn't give me any meaningful results.</p>
  
  <p>For example, the documentation in Robot Framework's built-in function <code>Run keyword if all tests passed</code> states that "Trying to use it anywhere else results in an error", so I was wondering that there should be some kind of way to apply this for custom keywords, too.</p>
  
  <p>I have tried to fix this by parsing the test file before starting the test execution and checking for any occurences of <code>My Setup</code> that are not in Test Setup. This, however, feels very cumbersome, so what I'm looking for is something like following:</p>
  
  <pre><code>def MySetup(self, some_arg):
      if MAGIC.not_inside_test_setup():
          raise AssertionError('"My Setup" can be executed only in Test Setup')
  </code></pre>