import unittest import sys import IPython from os import path # Update the path to ensure we can import from main.py sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) # Import the necessary objects from main.py # Assuming main.py includes appropriate functions/classes for authorization and spreadsheet management from main import authorize, Spreadsheet, Worksheet class TestPygsheets(unittest.TestCase): @classmethod def setUpClass(cls): """Run once to set up any state that's shared across tests.""" cls.gc = authorize(client_secret='auth_test_data/client_secret.json', credentials_directory='auth_test_data') def test_open_sheet(self): """Test opening a specific Google Sheet.""" ss = self.gc.open('manualTestSheet') self.assertIsInstance(ss, Spreadsheet) print(ss) wks = ss.sheet1 self.assertIsInstance(wks, Worksheet) print(wks) def test_embed(self): """Test that enables IPython embedded console for manual inspection.""" IPython.embed() if __name__ == '__main__': unittest.main()