How to avoid .pyc files using selenium webdriver/python while running test suites?
<p>There's no relevant answer to this question. When I run my test cases inside a test suite using selenium webdriver with python the directory gets trashed with .pyc files. They do not appear if I run test cases separately, only when I run them inside one test suite.How to avoid them?</p>

<pre><code>import unittest
from FacebookLogin import FacebookLogin
from SignUp import SignUp
from SignIn import SignIn

class TestSuite(unittest.TestSuite):
    def suite():
        suite = unittest.TestSuite()

        suite.addTest(FacebookLogin("test_FacebookLogin"))
        suite.addTest(SignUp("test_SignUp"))
        suite.addTest(SignIn("test_SignIn"))
        return suite

if __name__ == "__main__":
    unittest.main()
</code></pre>

<p>You can supply the -B option to the interpreter stop the files from being generated. See: <a href="http://stackoverflow.com/questions/154443/how-to-avoid-pyc-files">How to avoid pyc files</a></p>

<p>If you really wanted to, you could also add to your test script a cleanup after running the test. Not that I'm recommending that.</p>

<pre><code>import os
pyc_files = [fn for fn in os.listdir(os.getcwd()) if fn.endswith(".pyc")]
for filename in pyc_files:
    os.remove(filename)
</code></pre>

python selenium