~nskaggs/ubuntu-calendar-app/remove-xauthority

« back to all changes in this revision

Viewing changes to tests/autopilot/calendar_app/tests/__init__.py

  • Committer: nskaggs
  • Date: 2016-03-11 21:15:11 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20160311211511-1fzwnc7mcj5m4kt2
removeĀ _copy_xauthority_file

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
            "com.ubuntu.calendar",
84
84
            emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
85
85
 
86
 
    def _copy_xauthority_file(self, directory):
87
 
        """ Copy .Xauthority file to directory, if it exists in /home
88
 
        """
89
 
        # If running under xvfb, as jenkins does,
90
 
        # xsession will fail to start without xauthority file
91
 
        # Thus if the Xauthority file is in the home directory
92
 
        # make sure we copy it to our temp home directory
93
 
 
94
 
        xauth = os.path.expanduser(os.path.join(os.environ.get('HOME'),
95
 
                                   '.Xauthority'))
96
 
        if os.path.isfile(xauth):
97
 
            logger.debug("Copying .Xauthority to %s" % directory)
98
 
            shutil.copyfile(
99
 
                os.path.expanduser(os.path.join(os.environ.get('HOME'),
100
 
                                   '.Xauthority')),
101
 
                os.path.join(directory, '.Xauthority'))
102
 
 
103
86
    def patch_home(self):
104
87
        """ mock /home for testing purposes to preserve user data
105
88
        """
117
100
            temp_dir = temp_dir_fixture.path
118
101
 
119
102
            # before we set fixture, copy xauthority if needed
120
 
            self._copy_xauthority_file(temp_dir)
121
103
            self.useFixture(fixtures.EnvironmentVariable('HOME',
122
104
                                                         newvalue=temp_dir))
123
105