From 5ab003534897c36bbcfeef0fcdf390957b5d276f Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Fri, 30 Jul 2021 10:21:52 -0400 Subject: [PATCH] run tests on windows and mac --- .github/workflows/main.yml | 16 ++++++++++++---- tests/unit/test_conf.py | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4105973f6..024bfe438 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,8 +31,8 @@ jobs: matrix: os: - ubuntu-latest - #- macos-latest - #- windows-latest + - macos-latest + - windows-latest runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -49,10 +49,18 @@ jobs: key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} restore-keys: ${{ runner.os }}-pip- - run: pip install --user --upgrade pip wheel - - run: pip install -e .[torrent,test] - - env: + - if: startsWith(runner.os, 'linux') + run: pip install -e .[torrent,test] + - if: startsWith(runner.os, 'linux') + env: HOME: /tmp run: make test-unit-coverage + - if: !startsWith(runner.os, 'linux') + run: pip install -e .[test] + - if: !startsWith(runner.os, 'linux') + env: + HOME: /tmp + run: python -m unittest tests/unit/test_conf.py tests-integration: name: "tests / integration" diff --git a/tests/unit/test_conf.py b/tests/unit/test_conf.py index e241dea5f..645406462 100644 --- a/tests/unit/test_conf.py +++ b/tests/unit/test_conf.py @@ -21,6 +21,27 @@ class TestConfig(BaseConfig): class ConfigurationTests(unittest.TestCase): + @unittest.skipIf('darwin' not in sys.platform, 'skipping mac only test') + def test_mac_defaults(self): + c = Config() + self.assertEqual(c.data_dir, os.path.expanduser("~/Library/Application Support/LBRY")) + self.assertEqual(c.wallet_dir, os.path.expanduser('~/.lbryum')) + self.assertEqual(c.download_dir, os.path.expanduser('~/Downloads')) + self.assertEqual(c.config, os.path.join(c.data_dir, 'daemon_settings.yml')) + self.assertEqual(c.api_connection_url, 'http://localhost:5279/lbryapi') + self.assertEqual(c.log_file_path, os.path.join(c.data_dir, 'lbrynet.log')) + + @unittest.skipIf('win32' not in sys.platform, 'skipping windows only test') + def test_windows_defaults(self): + c = Config() + prefix = os.path.join(r"C:\Users", os.getlogin(), r"AppData\Local\lbry") + self.assertEqual(c.data_dir, os.path.join(prefix, 'lbrynet')) + self.assertEqual(c.wallet_dir, os.path.join(prefix, 'lbryum')) + self.assertEqual(c.download_dir, os.path.join(r"C:\Users", os.getlogin(), "Downloads")) + self.assertEqual(c.config, os.path.join(c.data_dir, 'daemon_settings.yml')) + self.assertEqual(c.api_connection_url, 'http://localhost:5279/lbryapi') + self.assertEqual(c.log_file_path, os.path.join(c.data_dir, 'lbrynet.log')) + @unittest.skipIf('linux' not in sys.platform, 'skipping linux only test') def test_linux_defaults(self): c = Config()