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()
def test_raises_fnf(self): """Test that creation raises OSError.""" with self.assertRaises(OSError): File.from_path("random_name_that_does_not_exist")
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)