Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platformdirs #481

Merged
merged 4 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.10
- appdirs
- platformdirs
- beautifulsoup4
- jinja2
- pandas>=1.0
Expand Down
2 changes: 1 addition & 1 deletion ci/37-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.7
- appdirs
- platformdirs
- beautifulsoup4
- jinja2
- pandas>=1.0
Expand Down
2 changes: 1 addition & 1 deletion ci/37.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.7
- appdirs
- platformdirs
- beautifulsoup4
- jinja2
- pandas>=1.0
Expand Down
2 changes: 1 addition & 1 deletion ci/38.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.8
- appdirs
- platformdirs
- beautifulsoup4
- jinja2
- pandas>=1.0
Expand Down
2 changes: 1 addition & 1 deletion ci/39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.9
- appdirs
- platformdirs
- beautifulsoup4
- jinja2
- pandas>=1.0
Expand Down
2 changes: 1 addition & 1 deletion libpysal/examples/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import webbrowser
from os import environ, makedirs
from os.path import exists, expanduser, join
from appdirs import user_data_dir
from platformdirs import user_data_dir
import zipfile
import requests
import pandas
Expand Down
27 changes: 25 additions & 2 deletions libpysal/examples/tests/test_available.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
#!/usr/bin/env python3

import os
import platform
import unittest
import numpy as np
import pandas

from .. import available
from ..base import get_data_home

class Testavailable(unittest.TestCase):
os_name = platform.system()

class Testexamples(unittest.TestCase):

def test_available(self):
examples = available()
self.assertEqual(type(examples), pandas.core.frame.DataFrame)

def test_data_home(self):
pth = get_data_home()
head, tail = os.path.split(pth)
self.assertEqual(tail, 'pysal')
if os_name == 'Linux':
heads = head.split("/")
self.assertEqual(heads[1], 'home')
self.assertEqual(heads[-1], 'share')
self.assertEqual(heads[-2], '.local')
elif os_name == 'Darwin':
heads = head.split("/")
self.assertEqual(heads[1], 'Users')
self.assertEqual(heads[-1], 'Application Support')
self.assertEqual(heads[-2], 'Library')
elif os_name == 'Windows':
heads = head.split("\\")
self.assertEqual(heads[1], 'Users')
self.assertEqual(heads[-2], 'Local')
self.assertEqual(heads[-3], 'AppData')

suite = unittest.TestLoader().loadTestsFromTestCase(Testavailable)
suite = unittest.TestLoader().loadTestsFromTestCase(Testexamples)

if __name__ == "__main__":
runner = unittest.TextTestRunner()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
appdirs
platformdirs
beautifulsoup4
jinja2
numpy>=1.3
Expand Down