title: How to generate path of a directory in python
body: <p>I have a file <code>abc.py</code> under the workspace dir. </p>
  
  <p>I am using <code>os.listdir('/home/workspace/tests')</code> in <code>abc.py</code> to list all the files (<code>test1.py</code>, <code>test2.py</code>...)</p>
  
  <p>I want to generate the path  <code>'/home/workspace/tests'</code> or even <code>'/home/workspace'</code> instead of hardcoding it. </p>
  
  <p>I tried <code>os.getcwd()</code> and <code>os.path.dirname(os.path.abspath(____file____))</code> but this instead generates the path where the test script is being run.</p>
  
  <p>How to go about it?</p>