Skip to content

Commit

Permalink
Test improvements and autoupdates for pip
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Dec 27, 2022
1 parent 096c5b8 commit ddbd927
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ updates:
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"prepublishOnly": "git push --follow-tags && gh-release -y",
"test": "run-s test:*",
"test-skip:standard": "standard",
"test:tap": "c8 tap --reporter specy --jobs 1 --no-timeout --no-bail --no-coverage --color",
"test:tap": "c8 tap --jobs-auto --reporter specy --no-bail --no-coverage --color --timeout 1200000",
"version": "run-s version:*",
"version:changelog": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING CHANGE:'",
"version:git": "git add CHANGELOG.md"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yt-dlp==2022.11.11
23 changes: 11 additions & 12 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const token = process?.env?.GITHUB_TOKEN
const [tmpdir, cleanup] = await tmp()
let results

tap.teardown(async () => {
await cleanup()
console.log('cleaned up folder')
})

tap.test('download a bin', async t => {
const octokitOpts = token ? { auth: token } : null
results = await downloadFromGithub({
Expand All @@ -25,7 +30,7 @@ tap.test('download a bin', async t => {
t.ok(results, 'downloaded')
})

tap.test('download video with promise', { timeout: 0 }, async t => {
tap.test('download video with promise', async t => {
const dir = t.testdir()
const testVideoPath = join(dir, 'testVideo.mp4')

Expand All @@ -49,7 +54,7 @@ tap.test('download video with promise', { timeout: 0 }, async t => {
await unlink(testVideoPath)
})

tap.test('download video with event emitter', { timeout: 0 }, async t => {
tap.test('download video with event emitter', async t => {
const dir = t.testdir()
const testVideoPath = join(dir, 'testVideo.mp4')

Expand All @@ -67,7 +72,7 @@ tap.test('download video with event emitter', { timeout: 0 }, async t => {
await checkEventEmitter({ t, bcDLPEventEmitter, testVideoPath })
})

tap.test('download video with readable stream', { timeout: 0 }, async t => {
tap.test('download video with readable stream', async t => {
const dir = t.testdir()
const testVideoPath = join(dir, 'testVideo.mp4')

Expand All @@ -84,7 +89,7 @@ tap.test('download video with readable stream', { timeout: 0 }, async t => {
await checkReadableStream({ t, bcDLPStream: readStream, execEventEmitter, testVideoPath, pipe })
})

tap.test('abort event emitter download', { timeout: 0 }, async t => {
tap.test('abort event emitter download', async t => {
const dir = t.testdir()
const testVideoPath = join(dir, 'testVideo.mp4')

Expand All @@ -97,7 +102,7 @@ tap.test('abort event emitter download', { timeout: 0 }, async t => {
t.ok(bcDLPEventEmitter.child?.killed, 'process is aborted')
})

tap.test('abort stream download', { timeout: 0 }, async t => {
tap.test('abort stream download', async t => {
const dir = t.testdir()
const testVideoPath = join(dir, 'testVideo.mp4')

Expand All @@ -110,7 +115,7 @@ tap.test('abort stream download', { timeout: 0 }, async t => {
t.ok(execEventEmitter.child?.killed, 'process is aborted')
})

tap.todo('abort promise download', { timeout: 0 }, async t => {
tap.todo('abort promise download', async t => {
// This test crashes when aborting yt-dlp for some reason.
const dir = t.testdir()
const testVideoPath = join(dir, 'testVideo.mp4')
Expand Down Expand Up @@ -174,11 +179,6 @@ tap.test('extractor description list should include YouTube.com playlists', asyn
t.ok(extractorList.includes('youtube:playlist: YouTube playlists'), 'extractor descriptions includes youtube playlists')
})

tap.test('cleanup', async t => {
await cleanup()
t.ok(true, 'cleaned up')
})

async function checkEventEmitter ({ t, bcDLPEventEmitter, testVideoPath }) {
let progressDefined = false
bcDLPEventEmitter.on('progress', (progressObject) => {
Expand Down Expand Up @@ -241,7 +241,6 @@ async function checkReadableStream ({ t, bcDLPStream, execEventEmitter, testVide
const waiter = new Promise((resolve, reject) => { waiterResolve = resolve })

bcDLPStream.on('close', async () => {
console.log('closing')
const stats = await stat(testVideoPath)
t.ok(stats, 'video exists')
t.equal(stats.size, expectedVideoSize)
Expand Down

0 comments on commit ddbd927

Please sign in to comment.