Пример #1
0
 def setUp(self):
     """Create a test file entry."""
     self.file = File.from_path(__file__)
     self.conn = engine.connect()
     self.trans = self.conn.begin()
     self.session = session_factory(bind=self.conn)
     self.session.add(self.file)
     self.session.commit()
Пример #2
0
 def test_raises_fnf(self):
     """Test that creation raises OSError."""
     with self.assertRaises(OSError):
         File.from_path("random_name_that_does_not_exist")
Пример #3
0
def init_tutorial():
    """Create the tutorial notebook."""
    fp = os.path.join(config['paths']['notebooks'], 'tutorial.ipynb')
    with scoped_session() as session:
        tutorial = File.from_path(fp)
        session.add(tutorial)