[tests] Fix tests on Travis

This commit is contained in:
Nemo 2020-06-15 00:30:05 +05:30
parent 1a29800787
commit a37ef7236b
3 changed files with 10 additions and 8 deletions

View File

@ -65,11 +65,12 @@ Note that the `--chrome` and `--firefox` options are independent, and can be use
### Google Chrome Profile Path
Where your Profile is stored depends on which version of chrome you are using:
Where your Profile is stored depends on [which version of chrome you are using](https://chromium.googlesource.com/chromium/src.git/+/62.0.3202.58/docs/user_data_dir.md#linux):
- `google-chrome-stable`: `~/.config/google-chrome/Default/`
- `google-chrome-unstable`: `~/.config/google-chrome-unstable/Default/`
- `chromium`: `~/.config/chromium/Default/`
- [Chrome Stable] `~/.config/google-chrome/Default`
- [Chrome Beta] `~/.config/google-chrome-beta/Default`
- [Chrome Dev] `~/.config/google-chrome-unstable/Default`
- [Chromium] `~/.config/chromium/Default`
Replace `Default` with `Profile 1`, `Profile 2` or so on if you use multiple profiles on Chrome. Note that the `--chrome` option accepts a `PROFILE-PATH`, not the History file itself. Also note that sometimes `~` might not be set, so you might need to use the complete path (such as `/home/nemo/.config/google-chrome/Default/`).
@ -112,6 +113,7 @@ On every launch, a request is made to `https://pypi.python.org/pypi/hackertray/j
- Mark Rickert for [Hacker Bar](http://hackerbarapp.com/) (No longer active)
- [Giridaran Manivannan](https://github.com/ace03uec) for troubleshooting instructions.
- [@cheeaun](https://github.com/cheeaun) for the [Unofficial Hacker News API](https://github.com/cheeaun/node-hnapi/)
## Licence

View File

@ -12,7 +12,7 @@ class Firefox:
@staticmethod
def default_firefox_profile_path():
profile_file_path = Path.home().joinpath(".mozilla/firefox/profiles.ini")
profile_file_path = str(Path.home().joinpath(".mozilla/firefox/profiles.ini"))
profile_path = None
if (os.path.exists(profile_file_path)):
parser = configparser.ConfigParser()

View File

@ -19,8 +19,8 @@ class FirefoxTest(unittest.TestCase):
def test_default(self):
test_default_path = Path.home().joinpath(".mozilla/firefox/x0ran0o9.default")
if(os.environ.get('TRAVIS') == 'true'):
if not os.path.exists(test_default_path):
os.makedirs(test_default_path)
if not os.path.exists(str(test_default_path)):
os.makedirs(str(test_default_path))
with open(str(Path.home().joinpath('.mozilla/firefox/profiles.ini')), 'w') as f:
f.write("""
[Profile1]
@ -29,4 +29,4 @@ IsRelative=1
Path=x0ran0o9.default
Default=1
""")
self.assertTrue(Firefox.default_firefox_profile_path()==Path.home().joinpath(".mozilla/firefox/x0ran0o9.default"))
self.assertTrue(Firefox.default_firefox_profile_path()==str(Path.home().joinpath(".mozilla/firefox/x0ran0o9.default")))