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

Yoda diary add notes and tasks outside virtualenv #116

Open
vccolombo opened this issue Jun 14, 2018 · 2 comments
Open

Yoda diary add notes and tasks outside virtualenv #116

vccolombo opened this issue Jun 14, 2018 · 2 comments

Comments

@vccolombo
Copy link

What are the steps to reproduce this issue?

  1. … source into venv
  2. … run coverage test in a dev build
  3. … deactivate from venv
  4. ... yoda diary notes / yoda diary tasks

What happens?

… The tests add test notes into the diary

What were you expecting to happen?

… Shouldn't the diary be environment dependable? I mean, if I'm developing a new feature and I want to test it, it adds notes to my 'personal use' yoda outside the virtualenv. And then when I want to use the diary to keep track of my tasks, there is a lot of garbage from the testing.
... Also, it seems that installing yoda again does not clean the diary notes.

Enhancement idea:

... I don't know where the diary is being stored, but is there a way to store in a place that is not the same for all virtualenvs?

@manparvesh
Copy link
Member

@vccolombo yes you're right.
I didn't think of that while writing the tests. This also applies while running some other tests, like the ones for flashcards, define etc.
We need to create dummy data for tests so that the original config is not disturbed.

Regarding your Enhancement idea, yes, It's possible to implement that too, but it's not there yet.

@zuziik
Copy link

zuziik commented Jun 18, 2018

I think all you need to do is to run tests within a test directory and delete the directory afterwards. Since all the data are currently stored in files and there is no option to delete them, running the tests automatically adds garbage data to the local instance.

So before starting the tests, we should create a test subdirectory and change these values accordingly:
YODA_CONFIG_FILE_PATH = os.path.join(os.path.expanduser('~'), '.yodaconfig')
DEFAULT_CONFIG_PATH = os.path.join(os.path.expanduser('~'), '.yoda')

After running the tests, the directories would be simply deleted.

@manparvesh manparvesh added this to the v0.4.0 milestone Jun 18, 2018
zuziik added a commit to zuziik/yoda that referenced this issue Jun 18, 2018
Tests updated so that they are running with a temporary folder as a config folder which is deleted after the tests are executed (either successfully or not). The test data are not mixed with user data of a developer.

Refers to the following issue:
yoda-pa#116

Changes
- a function is executed prior to each test which creates a temporary folder and changes the yoda config path to this folder
- a function is executed after each test which deletes the folder and restores the original yoda config path
- therefore, all constants refering to file paths (in all modules) have been changed to functions, so that they are able to react to config path changes (otherwise it could result in a weird behaviour)
(changing file path constants to dynamically resolved functions also helps in cases where two instances of yoda are run simultaneously and one of them changes the config path)
@zuziik zuziik mentioned this issue Jun 18, 2018
@manparvesh manparvesh modified the milestones: v0.4.0, v1.0.0 Jan 11, 2019
@manparvesh manparvesh modified the milestones: v1.0.0, v2.0.0 May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants