def test_withall(tmpmod):
 with tmpmod.mkdir('xontrib').join('spameggs.py').open('w') as x:
  x.write("\n__all__ = 'spam', '_foobar'\nspam = 1\neggs = 2\n_foobar = 3\n")
 ctx = xontrib_context('spameggs')
 assert (ctx == {'spam': 1, '_foobar': 3})

def test_withall ( tmpmod ) : with tmpmod . mkdir ( 'xontrib' ) . join ( 'spameggs.py' ) . open ( 'w' ) as x : x . write ( "\n__all__ = 'spam', '_foobar'\nspam = 1\neggs = 2\n_foobar = 3\n" ) ctx = xontrib_context ( 'spameggs' ) assert ( ctx == { 'spam' : 1 , '_foobar' : 3 } )
tests what gets exported from a module with __all__ .