title: Module has no attribute error when unittest is run in python
body: <pre><code>import avahi
  import dbus
  
  __author__ = 'michael'
  
  
  class AvahiServicePublisher():
  
      def __init__(self):
          self.group = None
          bus = dbus.SystemBus()
          server = dbus.Interface(
              bus.get_object(
                  avahi.DBUS_NAME,
                  avahi.DBUS_PATH_SERVER),
              avahi.DBUS_INTERFACE_SERVER)
  
          self.group = dbus.Interface(
              bus.get_object(avahi.DBUS_NAME,
                             server.EntryGroupNew()),
              avahi.DBUS_INTERFACE_ENTRY_GROUP)
  
      def publish(self, name, port, stype="_http._tcp", domain="", host="", text=""):
          self.group.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, dbus.UInt32(0),
                                name, stype, domain, host,
                                dbus.UInt16(port), text)
  
          self.group.Commit()
  
      def unpublish(self):
          self.group.Reset()
  </code></pre>
  
  <p>That's how I'm running unittest</p>
  
  <pre><code>python -m unittest tests.AvahiTest
  </code></pre>
  
  <p>Here is the error</p>
  
  <pre><code>Traceback (most recent call last):
    File "tests/AvahiTest.py", line 10, in setUp
      self.service_publisher = AvahiServicePublisher()
    File "avahi/AvahiServicePublisher.py", line 14, in __init__
      avahi.DBUS_NAME,
  AttributeError: 'module' object has no attribute 'DBUS_NAME'
  </code></pre>
  
  <p>So... How can I ran unittest without this error? And what is the reason for that error?</p>