Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

PicklingError using live_server fixture on Windows

Abierto
#54 13 comentarios 5 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
30/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
flask, python
Área
testing

Línea de trabajo

Empieza reproduciendo el fallo de la fixture live_server en Windows con Python 2.7.12; después, inspecciona pytest_flask/plugin.py alrededor de la línea 85 y pytest_flask/fixtures.py alrededor de las líneas 64 y 127. Sigue el inicio de multiprocessing que provoca PicklingError y determina si el resultado esperado es una fixture live_server funcional o una limitación documentada del soporte de Windows.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug stale

Not sure if Windows is supposed to be supported, but for me it fails on Windows 10 Python 2.7.12 with the following error when live_server fixture used:

request = <SubRequest '_push_request_context' for <Function 'test_get_url'>>                                                                                       
                                                                                                                                                                   
    @pytest.fixture(autouse=True)                                                                                                                                  
    def _push_request_context(request):                                                                                                                            
        """During tests execution request context has been pushed, e.g. `url_for`,                                                                                 
        `session`, etc. can be used in tests as is::                                                                                                               
                                                                                                                                                                   
            def test_app(app, client):                                                                                                                             
                assert client.get(url_for('myview')).status_code == 200                                                                                            
                                                                                                                                                                   
        """                                                                                                                                                        
        if 'app' not in request.fixturenames:                                                                                                                      
            return                                                                                                                                                 
                                                                                                                                                                   
        app = request.getfuncargvalue('app')                                                                                                                       
                                                                                                                                                                   
        # Get application bound to the live server if ``live_server`` fixture                                                                                      
        # is applyed. Live server application has an explicit ``SERVER_NAME``,                                                                                     
        # so ``url_for`` function generates a complete URL for endpoint which                                                                                      
        # includes application port as well.                                                                                                                       
        if 'live_server' in request.fixturenames:                                                                                                                  
>           app = request.getfuncargvalue('live_server').app                                                                                                       
                                                                                                                                                                   
..\..\..\..\python-virtualenv\shadow\Lib\site-packages\pytest_flask\plugin.py:85:                                                                                  
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _                                                                                    
..\..\..\..\python-virtualenv\shadow\Lib\site-packages\pytest_flask\fixtures.py:127: in live_server                                                                
    server.start()                                                                                                                                                 
..\..\..\..\python-virtualenv\shadow\Lib\site-packages\pytest_flask\fixtures.py:64: in start                                                                       
    self._process.start()                                                                                                                                          
c:\python27\Lib\multiprocessing\process.py:130: in start                                                                                                           
    self._popen = Popen(self)                                                                                                                                      
c:\python27\Lib\multiprocessing\forking.py:277: in __init__                                                                                                        
    dump(process_obj, to_child, HIGHEST_PROTOCOL)                                                                                                                  
c:\python27\Lib\multiprocessing\forking.py:199: in dump                                                                                                            
    ForkingPickler(file, protocol).dump(obj)                                                                                                                       
c:\python27\Lib\pickle.py:224: in dump                                                                                                                             
    self.save(obj)                                                                                                                                                 
c:\python27\Lib\pickle.py:331: in save                                                                                                                             
    self.save_reduce(obj=obj, *rv)                                                                                                                                 
c:\python27\Lib\pickle.py:425: in save_reduce                                                                                                                      
    save(state)                                                                                                                                                    
c:\python27\Lib\pickle.py:286: in save                                                                                                                             
    f(self, obj) # Call unbound method with explicit self                                                                                                          
c:\python27\Lib\pickle.py:655: in save_dict                                                                                                                        
    self._batch_setitems(obj.iteritems())                                                                                                                          
c:\python27\Lib\pickle.py:687: in _batch_setitems                                                                                                                  
    save(v)                                                                                                                                                        
c:\python27\Lib\pickle.py:286: in save                                                                                                                             
    f(self, obj) # Call unbound method with explicit self                                                                                                          
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _                                                                                    
                                                                                                                                                                   
self = <multiprocessing.forking.ForkingPickler instance at 0x0000000007EDBA08>                                                                                     
obj = <function <lambda> at 0x00000000081B9DD8>, name = '<lambda>'                                                                                                 
pack = <built-in function pack>                                                                                                                                    
                                                                                                                                                                   
    def save_global(self, obj, name=None, pack=struct.pack):                                                                                                       
        write = self.write                                                                                                                                         
        memo = self.memo                                                                                                                                           
                                                                                                                                                                   
        if name is None:                                                                                                                                           
            name = obj.__name__                                                                                                                                    
                                                                                                                                                                   
        module = getattr(obj, "__module__", None)                                                                                                                  
        if module is None:                                                                                                                                         
            module = whichmodule(obj, name)                                                                                                                        
                                                                                                                                                                   
        try:                                                                                                                                                       
            __import__(module)                                                                                                                                     
            mod = sys.modules[module]                                                                                                                              
            klass = getattr(mod, name)                                                                                                                             
        except (ImportError, KeyError, AttributeError):                                                                                                            
            raise PicklingError(                                                                                                                                   
                "Can't pickle %r: it's not found as %s.%s" %                                                                                                       
>               (obj, module, name))                                                                                                                               
E           PicklingError: Can't pickle <function <lambda> at 0x00000000081B9DD8>: it's not found as pytest_flask.fixtures.<lambda>                                
Lenguaje dominante
Python
Estrellas
499
Forks
93
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pytest-dev/pytest-flask

Todos los issues de pytest-dev/pytest-flask

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.