def test_ignore_stdlib_maybe_c(self): # The atexit module is implemented in C in python 3.3, so it # has a different filename and path than under 2.7. However, # on some systems (Linux?) the module is not even a dll, it's # a builtin. if not hasattr(atexit, '__file__'): self.skipTest('atexit is a builtin') t = tracer.Tracer(None, include_stdlib=False) self.assertTrue(t._should_ignore_file(atexit.__file__))
def test_ignore_stdlib(self): t = tracer.Tracer(None, include_stdlib=False) os_path = os.path.abspath(os.__file__) LOG.debug('checking %s', os_path) self.assertIn( os.path.dirname(os_path) + os.sep, t._stdlibdirs, ) LOG.debug('checking %s', os.__file__) self.assertTrue( t._should_ignore_file(os.__file__), 'should ignore %s' % os.__file__, )
def take_action(self, parsed_args): # Fix import path cwd = os.getcwd() if cwd not in sys.path and os.curdir not in sys.path: sys.path.insert(0, cwd) # Fix command line args sys.argv = parsed_args.command # Run the app p = publisher.Publisher(parsed_args.socket) t = tracer.Tracer(p) t.run(parsed_args.command) return
def test_interesting_locals(self): def _func(): pass t = tracer.Tracer(None) f = mock.Mock() f.f_locals = { 'simple_name': 1, 'module': tracer, 'function': _func, 'method': self.setUp, '__magic__': 2, } interesting = t._get_interesting_locals(f) self.assertEqual(interesting, {'simple_name': 1})
def take_action(self, parsed_args): # Fix import path cwd = os.getcwd() if cwd not in sys.path and os.curdir not in sys.path: sys.path.insert(0, cwd) # Fix command line args sys.argv = parsed_args.command # Run the app if parsed_args.mode == 'remote': p = publisher.Publisher(parsed_args.socket) else: p = local.LocalPublisher(parsed_args.database) t = tracer.Tracer(p) t.run(parsed_args.command) return
def test_include_site_packages(self): t = tracer.Tracer(None, include_site_packages=True) self.assertFalse(t._should_ignore_file(mock.__file__))
def test_ignore_site_packages(self): t = tracer.Tracer(None, include_site_packages=False) self.assertTrue( t._should_ignore_file(mock.__file__), 'should ignore %s' % mock.__file__, )
def test_include_smiley(self): t = tracer.Tracer(None, include_packages=['smiley']) self.assertFalse(t._should_ignore_file(tracer.__file__))
def test_ignore_coverage_by_default(self): t = tracer.Tracer(None) self.assertTrue(t._should_ignore_file(coverage.__file__))
def test_ignore_smiley_by_default(self): t = tracer.Tracer(None) self.assertTrue(t._should_ignore_file(tracer.__file__))
def test_capture_stdlib(self): t = tracer.Tracer(None, include_stdlib=True) self.assertFalse(t._should_ignore_file(site.__file__))
def test_ignore_stdlib(self): t = tracer.Tracer(None) self.assertTrue(t._should_ignore_file(atexit.__file__))