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

Don't rely on fs_extra #65

Closed
cnpryer opened this issue Aug 31, 2022 · 6 comments · Fixed by #444
Closed

Don't rely on fs_extra #65

cnpryer opened this issue Aug 31, 2022 · 6 comments · Fixed by #444
Labels
good first issue Good for newcomers

Comments

@cnpryer
Copy link
Owner

cnpryer commented Aug 31, 2022

Instead of using fs_extra to copy mock directories to tempdirs for testing, we can just create our own dir copying function.

Add to huak::utils::path a function copy_dir to copy one directory into another target dir.

@cnpryer
Copy link
Owner Author

cnpryer commented Aug 31, 2022

tag @GearBoxFox

@cnpryer
Copy link
Owner Author

cnpryer commented Aug 31, 2022

I don't think i can assign unless you're participating in this issue.

@cnpryer
Copy link
Owner Author

cnpryer commented Sep 8, 2022

Noting this as unassigned.

@cnpryer cnpryer added this to the 0.1.0 milestone Sep 11, 2022
@MrTanoshii
Copy link

Are you looking for a custom copy_dir or just a lock-in copy of https://github.com/webdesus/fs_extra/blob/master/src/dir.rs ?

Also do you want to keep the error codes of fs_extra or use IOError from https://github.com/cnpryer/huak/blob/master/src/huak/errors.rs for every error?

Note: I sent you a friend request on Discord.

@cnpryer
Copy link
Owner Author

cnpryer commented Oct 1, 2022

Are you looking for a custom copy_dir or just a lock-in copy of https://github.com/webdesus/fs_extra/blob/master/src/dir.rs ?

IIRC we're only using copy_dir to copy a mock project (from resources dir) into a tempdir for tests. We don't need all the configuration or error handling. Just copy all contents from here to here. But...

I don't really want to do this for testing in the future. I'm hoping we can just hardcode tests as needed. As an example, if I want to test the fmt operations we can just hardcode an unformatted python function, serialize it to the tempdir, run, and then assert.

#[test]
fn test_fmt() {
    let py = r#"""\
def some_fn(
):
    pass
"""#;
    write(py, dir.join("mock.py"));
    let res = read(dir.join("mock.py"));
    let ans = r#"""\
def some_fn():
    pass
"""#;
    assert_eq!(res, ans);
}

I might be missing some edge cases. So we probably should wait to do this, but you get my point hopefully. At that point we should be able to rip copy_dir out altogether.

@cnpryer
Copy link
Owner Author

cnpryer commented Oct 1, 2022

Also we have a discord if you want to join that https://discord.gg/St3menxFZT

@cnpryer cnpryer mentioned this issue Oct 1, 2022
@cnpryer cnpryer removed this from the 0.1.0 milestone Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants