Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9156067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:42:15+00:00 2026-06-17T12:42:15+00:00

I have a Python package that needs access to X11. I want to use

  • 0

I have a Python package that needs access to X11. I want to use Xvfb so that I do not have to have a real X11 installed on the build machines — Hudson in this case. So, I would like to start a Xvfb server when py.test starts, use that one server for all the tests, then close it down.

How can I do that?


Note: I could start(stop) an Xvfb server in the SetUp(TearDown) in each test class but that has two problem: First, it is wasteful. Second, it does not work due to either strange Fatal IO error 0 (Success) on X server if I terminate the server correctly or I get hanging Xvfb processes that do not die. This is using xvfbwrapper if anyone is interested.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:42:16+00:00Added an answer on June 17, 2026 at 12:42 pm

    You could use pytest-xvfb instead of messing with this… It would be easier.


    It is actually fairly simple. Create a file called conftest.py in your project root which contains this:

    import pytest
    import os
    import subprocess
    import tempfile
    
    @pytest.fixture(scope="session", autouse=True)
    def start_xvfb_server (request):
        tempdir = tempfile.mkdtemp()
        xvfb_cmd = ['Xvfb',
                    ':1022',
                    '-screen', '0', '800x600x24',
                    '-fbdir', tempdir,
                    '-noreset'
        ]
        xvfb_proc = subprocess.Popen(xvfb_cmd,
                stdout=open(os.devnull),
                stderr=open(os.devnull),
                shell=False
        )
        request.addfinalizer(xvfb_proc.kill)
    

    Now, all you have to do is to set up each tests to set the DISPLAY to 1022 which is trivial to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that uses Django 1.3 installed in python's site-packages. I want
I have an rpm package that needs to be installed on SLES 11. The
I have a Python script that I want to use as a controller to
I have a small GTK python application that imports a package (Twisted) that may
I have installed python 32 package to the C:\python32 I have also set the
I want to package a Python script so that it can run as a
I need to install mysql-python under python2.6. mysql-python package needs python2.6-devel package that depends
I want an app or python package that can 1.Dynamically add python script to
Python has a win32service package that seems to allow windows service creation. I have
I have build a Debian package out of a Python project which depends on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.