def test_data_name_third_party_package():
 data_dir = os.path.join(os.path.dirname(__file__), u'data')
 sys.path.insert(0, data_dir)
 try:
  import test_package
  filename = test_package.get_data_filename()
  assert (filename == os.path.join(data_dir, u'test_package', u'data', u'foo.txt'))
 finally:
  sys.path.pop(0)

def test_data_name_third_party_package ( ) : data_dir = os . path . join ( os . path . dirname ( __file__ ) , u'data' ) sys . path . insert ( 0 , data_dir ) try : import test_package filename = test_package . get_data_filename ( ) assert ( filename == os . path . join ( data_dir , u'test_package' , u'data' , u'foo.txt' ) ) finally : sys . path . pop ( 0 )
regression test for issue #1256 tests that get_pkg_data_filename works in a third-party package that doesnt make any relative imports from the module its used from .